Tuesday, January 20, 2009

Oracle PL/SQL Packages






PL/SQL package is used to group related PL/SQL code and constructs together.

There are two parts of PL/SQL package:

1. Package specification - declares the public components of the package
2. Package body - implements public and private components of the package

Below is an example of PL/SQL package.

CREATE PACKAGE reg_pkg IS
PROCEDURE getstud;
FUNCTION total_student RETURN NUMBER;
END reg_pkg;
/
CREATE PACKAGE BODY reg_pkg IS
PROCEDURE getstud IS ...
BEGIN ... END;

FUNCTION total_student RETURN NUMBER IS ...
BEGIN ... RETURN total_stud; END;
END reg_pkg;
/

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home