CREATE PACKAGE / PACKAGE BODY

Create a PL/SQL stored package. A package is a database object that contains PL/SQL types, objects and subprograms.

Syntax:

   CREATE [OR REPLACE] PACKAGE [schema.]package_name [invoker_rights] AS package

   CREATE [OR REPLACE] PACKAGE BODY [schema.]package_name AS plsql_package_body

   invoker_rights:  
      AUTHID CURRENT_USER
      AUTHID DEFINER

AUTHID DEFINER will cause the package to execute with the privileges of the package owner.

Example

CREATE or REPLACE PACKAGE SS64_data as
   TYPE ss64_cursor IS REF CURSOR RETURN all_objects%rowtype
END SS64_data;

CREATE or REPLACE PROCEDURE get_owner_objects(owner_name IN varchar2,
 cat_cursor IN OUT SS64_data.ss64_cursor)
BEGIN
    OPEN cat_cursor FOR SELECT * from all_objects WHERE owner=owner_name;
END;

"If you have built castles in the air, your work need not be lost… put foundations under them" ~ Henry David Thoreau

Related Commands:

ALTER PACKAGE
DROP PACKAGE
An overview of Stored Procedures & PL/SQL

Related Views:

 CODE_PIECES
 CODE_SIZE
 DBA_SOURCE      ALL_SOURCE      USER_SOURCE


© Copyright SS64.com 1999-2014
Some rights reserved