PL/SQL is a block structured language that enables developers to combine the power of SQL with procedural statements.All the statements of a block are passed to oracle engine all at once which increases processing speed and decreases the traffic.
Disadvantages of SQL:
- SQL doesn’t provide the programmers with a technique of condition checking, looping and branching.
- SQL statements are passed to Oracle engine one at a time which increases traffic and decreases speed.
- SQL has no facility of error checking during manipulation of data.
Features of PL/SQL:
- PL/SQL is basically a procedural language, which provides the functionality of decision making, iteration and many more features of procedural programming languages.
- PL/SQL can execute a number of queries in one block using single command.
- One can create a PL/SQL unit such as procedures, functions, packages, triggers, and types, which are stored in the database for reuse by applications.
- PL/SQL provides a feature to handle the exception which occurs in PL/SQL block known as exception handling block.
- Applications written in PL/SQL are portable to computer hardware or operating system where Oracle is operational.
- PL/SQL Offers extensive error checking.
Differences between SQL and PL/SQL:
|SQL is a single query that is used to perform DML and DDL operations.||PL/SQL is a block of codes that used to write the entire program blocks/ procedure/ function, etc.|
|It is declarative, that defines what needs to be done, rather than how things need to be done.||PL/SQL is procedural that defines how the things needs to be done.|
|Execute as a single statement.||Execute as a whole block.|
|Mainly used to manipulate data.||Mainly used to create an application.|
|Cannot contain PL/SQL code in it.||It is an extension of SQL, so it can contain SQL inside it.|