Share Knowledge and Skills

Friday, 10 October 2014

PL / SQL

12:31 Posted by Unknown No comments
 PL / SQL:

PL/SQL is a procedural extension to a non – procedural language SQL.

PL/SQL is a Database Language restricted only to do the database activities. ( Unlike Other General Purpose Languages like C, C++, Java, Etc )

Named PL/SQL Sub-Programs that can be stored within the database are: Procedures, Functions, Triggers and Packages.

Benefits of PL/SQL

Integration.
Modularized Application Development.
Improved Performance.
Provides Exception / Error Handling Capability.
Reusability of Code.
Provides Encapsulation, Overloading, etc.

PL/SQL Block

            Declare        (Optional)
                     
                     Variables, Cursors and User defined Exception.
         
            Begin            (Mandatory)
                         
                     SQL, PL/SQL Statements

           Exception      (Optional)
         
                     Action to perform when exception occurs.

           End;

Data Types in PL/SQL:
                                         
                                Data Types

     Scalar Data Types    Composite Data Types

Scalar Data Types:
o Holds Single Value.
o Has No Internal Components.

Char [ Max Length ]
Varchar2 [ Max Length ]
Long
Long Raw
Number [ Precision, Scale]
Binary_Integer
Boolean.


Flow Control Statements:
1. If
2. If … Elsif
3. goto
4. Raise

Iterative Statements:
1. Simple Loop.
2. While Loop.
3. For Loop.

0 comments:

Post a Comment