Advantages Offered by PL/SQL

Advantages Offered by PL-SQL

Advantages Offered by PL/SQL 

1) Block Structures: PL SQL consists of blocks of code, which can be nested within each other. Each block forms a unit of a task or a logical module. PL/SQL Blocks can be stored in the database and re-used. 

2) Better Performance: PL SQL engine processes multiple SQL statements simultaneously as a single block, thereby reducing network traffic. 

3) Error Handling: PL/SQL handles errors or exceptions effectively during the execution of a PL/SQL program. Once an exception is caught, specific actions can be taken depending upon the type of the exception or it can be displayed to the user with a message. 

4) Procedural Capabilities: PL SQL consists of procedural language constructs such as conditional statements (if else statements) and loops like (FOR loops). PL/SQL is the procedural extension to Oracle SQL. That is, apart from supporting SQL, it also supports high level language features such as block structure, conditional statements, looping statements etc. 

5) Reduced Network Traffic: While SQL statements are sent one at a time, PL/SQL sends an entire block of statements (i.e., a block containing multiple statements) at one time. This reduces network traffic considerably. Recall that in SQL execution four people going to same destination in separate vehicles are now going together in one vehicle.

6) Error Handling Procedures/Routines: PL/SQL supports customized error handling routines i.e., a user can write his/her own error handling routines. 

7) Facilitates Sharing: PL/SQL allows the user to store compiled code in the database, thereby providing the access and sharing of the same subprograms by multiple applications. 

8) Improved Transaction Performance: PL/SQL, supports all sorts of calculations without involving Oracle Engine. This results in improved transaction performance. 

9) Portable Code: PL/SQL code can be executed on any computer hardware and operating system provided Oracle is loaded on it as PL/SQL is integrated with the database server. It does not exist as a stand-alone language.