Humble Trader

Monday, January 30, 2006

PL/SQL Library Header

Pre-Requisites:

...

Code:

Paste this code into a .sql script and run it in SQL*PLUS by the owner of the target schema.

-- ------------------------------------------------------------------------- --
-- --
-- Title: p_script_lib.sql --
-- Author: Steve Roach --
-- --
-- Description: A set of library functions and procedures to ... --
-- --
-- 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 p_script_lib
AS
FUNCTION function(
...
... )
RETURN ...;

FUNCTION procedure(
...
... );
END p_script_lib;
/

SHOW ERRORS

CREATE OR REPLACE PACKAGE BODY p_script_lib
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 p_script_lib;
/

SHOW ERRORS


Test Script

0 Comments:

Post a Comment

<< Home