The following are the important differences between SQL and PL/SQL.

Difference Between SQL and PLSQL

 

Sr. No. Key SQL PL/SQL
1 Definition SQL, is Structural Query Language for database. PL/SQL is a programming language using SQL for a database.
2 Variables SQL has no variables. PL/SQL has variables, data types etc.
3 Variable declaration Column declaration A int:=100;

B varcharchar2(20):=’Lotus it hub’;

4 Control Structures SQL has no FOR loop, if control and similar structures. PL/SQL has FOR loop, while loop, if controls and other similar structures.
5 Basic c Sql doesn’t require to know c language. Plsql require to know c language.
6 Operations SQL can execute a single operation at a time. PL/SQL can perform multiple operations at a time.
7 Language Type SQL is a declarative language. PL/SQL is a procedural language.
8 Embedded SQL can be embedded in a PL/SQL block. PL/SQL can also be embedded in SQL code.
9 Interaction SQL directly interacts with database server. PL/SQL does not directly interact with database server.
10 Fetch  Select * from table_name Declare

Begin

Dbms_output.put_line(‘Lotus IT Hub!!’);

End;

/

8 Objective SQL is used to write queries, create and execute DDL and DML statements. PL/SQL is used to write program blocks, functions, procedures, triggers and packages.

 

PL/SQL Data Types

Data Type Description Size
BFILE Used to store large binary objects in operating system files outside the database. System-dependent. Cannot exceed 4 gigabytes (GB).
BLOB Used to store large binary objects in the database. 8 to 128 terabytes (TB)
CLOB Used to store large blocks of character data in the database. 8 to 128 TB
NCLOB Used to store large blocks of NCHAR data in the database. 8 to 128 TB
int -2,147,483,648 2,147,483,647
datetime Jan 1, 1753 Dec 31, 9999
float -1.79E + 308 1.79E + 308
real -3.40E + 38 3.40E + 38