Friday, 4 April 2014

About PL/SQL



PL/SQL is a combination of Procedural and Structured language. A PL/SQL statements can be stored at both side (client and server). PL/SQL stands by "Programming Language" extension of SQL.
It is very important to Manipulate, Control, Validate, and Restrict the Unauthorized Access of Data.

Generally a PL/SQL block consists of three parts:
i)                    Declaration:-
This section is optional and starts with reserved keyword ‘DECLARE’. Purpose of this part is to declare any placeholders like variables, constants, records and cursors.
ii)                   Execution:
This section is mandatory and starts with reserved keyword ‘BEGIN’ and ends with ‘END’. This actually contains the business logic.
iii)                 Exception:-
This section is optional and starts with reserved keyword ‘EXCEPTION’. To make sure that PL/SQL block gets terminated gracefully we handle any error and exception in this section.
                Syntax:
DECLARE
     Any Variable declaration
BEGIN
     Business logic
EXCEPTION
     Exception handling
END;

Advantage:-
i)                    Procedural language support:
It supports procedural language behavior like looping, if-else block which gives better control and improved logic implementation.
ii)                  Error/Exception handling:
It gives power of error/exception handling using that a developer can make sure that application gets terminated gracefully. Using this a developer can state a specific and correct error message when something goes wrong.
iii)                Optimized Performance:
It is capable to execute a big sql statement in one go which reduced the network traffic and improved the performance.

No comments:

Post a Comment