Syntax of the Create Package
- CREATE OR REPLACE PACKAGE [body] packagename IS
-
- END;
Sample:
- CREATE OR REPLACE PACKAGE overloaded IS
- PROCEDURE insby(namein VARCHAR2);
- PROCEDURE insby(numbin PLS_INTEGER);
- END overloaded;
- /
-
- CREATE OR REPLACE PACKAGE BODY overloaded IS
- --==========================================
- PROCEDURE local(namein VARCHAR2, nameout OUT VARCHAR2) IS
-
- BEGIN
- nameout := TRANSLATE(namein,'AEIOUaeiou','EIOUAeioua');
- END local;
- --==========================================
- PROCEDURE insby (namein VARCHAR2) IS
- x PLS_INTEGER;
- BEGIN
- SELECT MAX(seqno)+1
- INTO x
- FROM persons;
-
- INSERT INTO persons
- (seqno, name)
- VALUES
- (x, namein);
- COMMIT;
- END insby;
- --==========================================
- PROCEDURE insby (numbin PLS_INTEGER) IS
- x VARCHAR2(30);
- BEGIN
- SELECT MAX(name)
- INTO x
- FROM persons;
-
- local(x, x);
-
- INSERT INTO persons
- (seqno, name)
- VALUES
- (numbin, x);
- COMMIT;
- END insby;
- --==========================================
- END overloaded;
- /
-
- exec overloaded.insby('Helen Lofstrom');
-
- exec overloaded.insby(4);
Syntax of the Drop Package
DROP PACKAGE [BODY] [schema.]package_name;
Sample:
- DROP PACKAGE INV.INV_TRANSFER_ORDER_PVT;
- DROP PACKAGE BODY INV.INV_TRANSFER_ORDER_PVT;