Humble Trader

Monday, February 06, 2006

PL/SQL Package Header

This template is used as a header for PL/SQL Packages:

-- ------------------------------------------------------------------------- --
-- --
-- Title: pk_package.sql --
-- Author: Steve Roach --
-- --
-- Description: A package for... --
-- --
-- Functions: function --
-- ... --
-- --
-- Procedures: procedure --
-- ... --
-- --
-- Installation: To install for production, run this script as-is. This will --
-- install the package in the target database. --
-- To install for debug, edit the 'ALTER SESSION' statement, --
-- below, changing 'debug: FALSE' to 'debug: TRUE' before --
-- running the script. --
-- --
-- ------------------------------------------------------------------------- --

-- Set flags for running debug mode:
ALTER SESSION SET PLSQL_CCFLAGS = 'debug: FALSE';

-- Package definition.
CREATE OR REPLACE PACKAGE pk_package
AS
FUNCTION function(
...
... )
RETURN ...;

PROCEDURE procedure(
...
... );
END pk_package;
/

SHOW ERRORS

CREATE OR REPLACE PACKAGE BODY pk_package
AS
-- Description...
FUNCTION function(
...
... )
RETURN ...
IS
...
BEGIN
$IF $$debug
$THEN
dbms_output.put_line('function START');
$END

NULL;
...

$IF $$debug
$THEN
dbms_output.put_line('RETURN = ' || ...);
dbms_output.put_line('function END');
$END

RETURN ...;
END function;

-- Description...
PROCEDURE procedure(
...
... )
IS
...
BEGIN
$IF $$debug
$THEN
dbms_output.put_line('procedure START');
$END

NULL;
...

$IF $$debug
$THEN
dbms_output.put_line('procedure END');
$END
END procedure;
END pk_package;
/

SHOW ERRORS


Test Script

0 Comments:

Post a Comment

<< Home