|
Page 2 of 2
Private and Public Items in packages
Items declared in package body are private. They can only be accessed within the package. Where as items declared in package specification is public and is available outside package. It is explained in the following example.
The package shown in Fig 1 contains a variable Age_limit which is accessed by the program given below.

Overloading Packaged Subprograms:
Similar to the overloading concept in other programming languages PL/SQL also allows you to overload its subprograms.
We can have more than one subprogram with the same name within a package
Following examples better explain this concept.



Writing Cursor spec and body separately using Packages
The cursor specification can be written separate from its body using packages. It allows you to change cursor body without changing the cursor specification. Cursor coded in the package spec need to have a return type.
CURSOR cursor_name [(parameter [, parameter]...)] RETURN return_type;
The following examples explain how cursor can be declared and defined using packages.


Below given is the example that explains how to access the cursor values.

Download Sample Scripts
Trackback(0)

|