plsqlPackages


Syntax

  • CREATE [OR REPLACE] PACKAGE package_name

    [AUTHID {CURRENT_USER | DEFINER}]

    {IS | AS}

    [PRAGMA SERIALLY_REUSABLE;]

    [collection_type_definition ...]

    [record_type_definition ...]

    [subtype_definition ...]

    [collection_declaration ...]

    [constant_declaration ...]

    [exception_declaration ...]

    [object_declaration ...]

    [record_declaration ...]

    [variable_declaration ...]

    [cursor_spec ...]

    [function_spec ...]

    [procedure_spec ...]

    [call_spec ...]

    [PRAGMA RESTRICT_REFERENCES(assertions) ...]

    END [package_name];

  • CREATE OR REPLACE PACKAGE PackageName IS

    FUNCTION FunctionName(parameter1 IN VARCHAR2, paramter2 IN NUMBER) RETURN VARCHAR2;

    END PackageName;

  • CREATE [OR REPLACE] PACKAGE BODY package_name

    {IS | AS}

    [PRAGMA SERIALLY_REUSABLE;]

    [collection_type_definition ...]

    [record_type_definition ...]

    [subtype_definition ...]

    [collection_declaration ...]

    [constant_declaration ...]

    [exception_declaration ...]

    [object_declaration ...]

    [record_declaration ...]

    [variable_declaration ...]

    [cursor_body ...]

    [function_spec ...]

    [procedure_spec ...]

    [call_spec ...]

    END [package_name];

  • CREATE OR REPLACE PACKAGE BODY PackageName IS

    FUNCTION FunctionName(parameter1 IN VARCHAR2, paramter2 IN NUMBER) RETURN VARCHAR2 IS

    declarations

    BEGIN

    statements to execute

    RETURN varchar2 variable

    END FunctionName;

    END PackageName;