09.10.2014 Views

download pl/sql tutorial (pdf - Tutorials Point

download pl/sql tutorial (pdf - Tutorials Point

download pl/sql tutorial (pdf - Tutorials Point

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Parameter Modes in PL/SQL Subprograms ............................................ 67<br />

IN & OUT Mode Exam<strong>pl</strong>e 1 ..................................................................... 68<br />

IN & OUT Mode Exam<strong>pl</strong>e 2 ..................................................................... 68<br />

Methods for Passing Parameters ............................................................. 69<br />

POSITIONAL NOTATION ....................................................................... 69<br />

NAMED NOTATION ............................................................................... 69<br />

MIXED NOTATION ................................................................................. 69<br />

Functions ............................................................................... 70<br />

Exam<strong>pl</strong>e: .................................................................................................. 71<br />

Calling a Function .................................................................................... 71<br />

Exam<strong>pl</strong>e: .................................................................................................. 72<br />

PL/SQL Recursive Functions ................................................................... 72<br />

Cursors .................................................................................. 74<br />

Im<strong>pl</strong>icit Cursors ........................................................................................ 74<br />

Exam<strong>pl</strong>e: .................................................................................................. 75<br />

Ex<strong>pl</strong>icit Cursors ........................................................................................ 76<br />

Declaring the Cursor ................................................................................ 76<br />

Opening the Cursor ................................................................................. 76<br />

Fetching the Cursor ................................................................................. 76<br />

Closing the Cursor ................................................................................... 77<br />

Exam<strong>pl</strong>e: .................................................................................................. 77<br />

Records .................................................................................. 78<br />

Table-Based Records .............................................................................. 78<br />

Cursor-Based Records ............................................................................ 79<br />

User-Defined Records ............................................................................. 79<br />

Defining a Record .................................................................................... 80<br />

Accessing Fields ...................................................................................... 80<br />

Records as Subprogram Parameters ...................................................... 81<br />

Exceptions ............................................................................. 83<br />

Syntax for Exception Handling ................................................................. 83<br />

Exam<strong>pl</strong>e ................................................................................................... 83<br />

Raising Exceptions .................................................................................. 84<br />

User-defined Exceptions .......................................................................... 84<br />

Exam<strong>pl</strong>e: .................................................................................................. 85<br />

Pre-defined Exceptions ............................................................................ 85<br />

Triggers .................................................................................. 88<br />

Benefits of Triggers .................................................................................. 88<br />

Creating Triggers ..................................................................................... 89<br />

Exam<strong>pl</strong>e: .................................................................................................. 89<br />

iii

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!