What Is The Difference Between SQL And PL\SQL ?

7

7 Answers

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

2.) 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.

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

4.) 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).

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

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

7.) SQL is a language that is used by relational database technologies such as Oracle, Microsoft Access, and Sybase etc., PL/SQL is commonly used to write data-centric programs to manipulate data in an Oracle database. PL/SQL language includes object oriented programming techniques such as encapsulation, function overloading, and information hiding (all but inheritance).
thanked the writer.
Anonymous
Anonymous commented
Hi,
very useful answer . I am new to pl/sql . Can u plz explain 2nd point with an example.
Thanks
Anonymous Profile
Anonymous answered
What is SQL?

SQL (pronounced “sequal”) stands for Structured Query Language. Withe SQL, you can view data – called Data Definiton Language or DDL and manipulate data – called Data Manipulation Language or DML. All of the above are just a fancy way to say that with SQL, the user can both view and alter records in the database. To help , here are a couple of queries:

What is PL/SQL?

The official answer is from the PL/SQL User Guide:
PL/SQL, Oracle’s procedural extension of SQL, is an advanced fourth-generation programming language (4GL). It offers software-engineering features such as data encapsulation, overloading, collection types, exceptions, and information hiding. PL/SQL also supports rapid prototyping and development through tight integration with SQL and the Oracle database.
Huh? That is what I thought at the beginning. But at a high level, all this means is that it can do all of the things that regular SQL can do, but also, it is procedural and can be used like a programming language (C++, Java, etc.) For instance, you can use loops and If . . . Then statements in your PL/SQL statements (Programs).

Here is a definition of PL/SQL from Lewis Cunningham (an Oracle database expert):

“If I wanted to create my own, very short, definition of PL/SQL it would be this: PL/SQL is the Oracle native programming language that provides database-centric application development. It can natively call static SQL and provides multiple methods of calling dynamic SQL.

Mr. Cunningham also does a very good job of spelling out the differences between SQL and PL/SQL.

SQL is a data oriented language for selecting and manipulating sets of data. PL/SQL is a procedural language to create applications. You don’t normally have a “SQL application”. You normally have an application that uses SQL and a relational database on the back-end. PL/SQL can be the application language just like Java or PHP can. SQL may be the source of data for your screens, web pages and reports. PL/SQL might be the language you use to build, format and display those screens, web pages and reports.

Think of it like this: The code that makes your program function is PL/SQL. The code that manipulates the data is SQL DML. The code that creates stored database objects is SQL DDL. DDL compiles the code that is written in PL/SQL. PL/SQL may call SQL to perform data manipulation. The commands that format the output of a tool are not related to the SQL standard or to PL/SQL.
To muddy the waters a little more, while you cannot write an application in SQL, you can use a procedural language to automate parts. These are called Stored Procedures and here is a link to all you want to know about stored procedures on this site.
Anonymous Profile
Anonymous answered
In sql only one statement in executed at a time but in pl/sql the block of code is executed at a time
sql is used to create database,retreive database or alter etc,but pl/sql is used to program using cursor,procedures,functions such as java,c++ etc
Anonymous Profile
Anonymous answered
Sql is the simplified statement to save ,retrieve,delete the records.where as in pl sql is bunch of statement including some logics e.g cursors and procedure . Bunch of statement in pl sql executed in one time.loop structure are not present in SQL.
ray of light Profile
ray of light answered
SQL is a used for accessing databases. Where as PL/SQL is programming language which direct SQL and is use in Oracle.
Anonymous Profile
Anonymous answered
PL/SQL, Oracle's procedural extension of SQL, is an advanced fourth-generation programming language (4GL). It offers software-engineering features such as data encapsulation, overloading, collection types, exceptions, and information hiding. PL/SQL also supports rapid prototyping and development through tight integration with SQL and the Oracle database.
Anonymous Profile
Anonymous answered

PLSQL is SQL and the language that goes with it for Oracle. Start with SQL.SQL provides access to the database for retrieving data from the objects. However SQL does not have the programming capabilites.

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.

Answer Question

Anonymous