Exforsys

Home arrow Technical Training arrow Oracle 9i Training

Oracle 9i Packages Page - 2

Page 2 of 2
Author : Exforsys Inc.     Published on: 7th Apr 2005    |   Last Updated on: 24th Nov 2010

Oracle 9i Packages

Ads

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.


Ads

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

Download Sample Scripts



 
This tutorial is part of a Oracle 9i Training tutorial series. Read it from the beginning and learn yourself.

Oracle 9i Training

 

Comments