What is difference between SQL and PLSQL [Resolved]

Posted by Jitendrasoft09 under Sql Server on 6/26/2013 | Points: 10 | Views : 1968 | Status : [Member] [MVP] | Replies : 4
Hi All,
I want to understand What is difference between SQL and PLSQL , let me know if anybody knows.

Jitendra Kumar
If my post helps you, plz mark as an answer.


Posted by: Bageshkumarbagi on: 6/27/2013 [Member] Starter | Points: 50


SQL provides access to the database for retrieving data from the objects. However SQL does not have the programming capabilites. SQL does not provide:

.Loops: For iterating through records and manipulating single row at a time.
.Exceptions: Error handling.
.Code secure: SQL code cannot be stored in database and cannot be encrypted.
.Complex datatypes: cannot work with records, collections, arrays, objects, cursors, Bfiles etc.

PLSQL provides the capability of the programming language and supports the above mentioned list. It also supports running of SQL statements inside the PLSQL blocks.

Bagesh Kumar Singh

Bagesh Kumar Singh
Mark as answer if you have been satisfied

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Niladri.Biswas on: 6/26/2013 [Member] Platinum | Points: 25

a)SQL is a query language that allows you to issue a single query or execute a single insert/update/delete. PL-SQL is Oracle's "Programming Language" SQL, which allows you to write a full program (loops, variables, etc.) to accomplish multiple selects/inserts/updates/deletes.

b)SQL is a data oriented language for selecting and manipulating sets of data. PL/SQL is a procedural language to create applications.

c)PL/SQL can be the application language just like Java or PHP can. PL/SQL might be the language we use to build, format and display those screens, web pages and reports.SQL may be the source of data for our screens, web pages and reports.

d) SQL is executed one statement at a time. PL/SQL is executed as a block of code.

e) SQL tells the database what to do (declarative), not how to do it. In contrast, PL/SQL tell the database how to do things (procedural).

f) SQL is used to code queries, DML and DDL statements. PL/SQL is used to code program blocks, triggers, functions, procedures and packages.

g) We can embed SQL in a PL/SQL program, but we cannot embed PL/SQL within a SQL statement.

Source: http://stackoverflow.com/questions/290829/differences-between-sql-and-pl-sql

Best Regards,
Niladri Biswas

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 6/27/2013 [Member] [MVP] Silver | Points: 25

SQL (Structured Query Language) is the standard language to write entry relational databases. SQL is simple statements, which allows to retrieve, insert, delete, update records as user needs. Simply it is data oriented language for selecting and manipulating set of data. PL SQL (Procedural Language/Structured Query Language) is a procedural extension language for data entry and manipulation by Oracle.

"PL/SQL, Oracle's procedural extension of SQL, is an advanced fourth-generation programming language (4GL). It offers modern features such as data encapsulation, overloading, collection types, exception handling, and information hiding. PL/SQL also offers seamless SQL access, tight integration with the Oracle server and tools, portability, and security."


Structured query language (SQL) pronounced as "sequel" is a database computer language designed for managing data in relational database management systems (RDBMS), and originally based upon relational algebra.

Basic scope of SQL is to insert data and perform update, delete, schema creation, schema modification and data access control against databases.

SQL has elements, sub-divided into the followings:

Queries - Retrieve data, based on specific criteria. There are few keywords which can be used in queries. (Select, From, Where, Having, Group by and order by)

e.g: SELECT * FROM table1 WHERE column1 > condition ORDER BY column2;

Statements - That may control transactions, program flow, connections, sessions, or diagnostics

Expressions - That can produce either;

Scalar values

Tables consisting of columns and rows of data

Predicates -Specify conditions that can be evaluated to SQL Boolean (true/false/unknown)

Clauses - Constituent components of statements and queries


PL/SQL (Procedural Language/Structured Query Language) is Oracle Corporation's procedural extension language for SQL and the Oracle relational database. PL/SQL supports variables, conditions, loops, arrays, exceptions. PL/SQL essentially code containers can be complied in to the oracle databases. Software developers can therefore implant PL/SQL units of functionality into the database straight.

PL/SQL program units can be defined as follows:

Anonymous blocks

Forms the basis of simplest PL/SQL code


Functions are a collection of SQL and PL/SQL statements. Functions execute a task and should return a value to the calling environment.


Procedures are alike to Functions. Procedures also can be executed to perform work. Procedures cannot be used in a SQL statement, can return multiple values. In addition, functions can be called from SQL, while procedures cannot.


Use of packages is re-using of code. Packages are groups of theoretically linked Functions, Procedures, Variable, PL/SQL table and record TYPE statements, Constants & Cursors etc. Packages usually have two parts, a specification and a body

Two advantages of packages include:

Modular approach, encapsulation of business logic

Using packages variables can declare in session levels

Types of variables in PL/SQL


Numeric variables

Character variables

Date variables

Data types for specific columns

Difference between SQL and PL/SQL

SQL is data oriented language for selecting and manipulating data but PL SQL is a procedural language to create applications.

SQL executes one statement at a time whereas in PL SQL block of code could be executed.

SQL is declarative where as PL SQL is procedural.

SQL is used to write Queries, Data Manipulation Language (DML) and Data Definition Language (DDL) whereas PL SQL is used to write Program blocks, Triggers, Functions, Procedures, and Packages.


If this post helps you mark it as answer

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jitendrasoft09 on: 6/27/2013 [Member] [MVP] Starter | Points: 25

Thanks Satya, Niladri, nice explanation with short descriptions Bagesh....

Jitendra Kumar
If my post helps you, plz mark as an answer.

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response