A Way For Learning

Differences between SQL and PL-SQL

No comments
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. You should learn SQL first, then move on to PL-SQL. You will probably need both to be an Oracle DBA.

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.

For PLSQL code to be excute you should use the following command :
SET SERVEROUTPUT ON;

Difference between SQL and PL/SQL:-

SQL is a Structured Query Language used to issue a single query or execute a single insert/update/delete.
PL-SQL is a  programming language SQL, used to write full programs using variables, loops,operators etc. to carry out multiple selects/inserts/updates/deletes.

SQL may be considered as the source of data for our reports, web pages and screens.
PL/SQL can be considered as the application language similar to  Java or PHP. It might be the language used to build, format and display those reports, web pages and screens.

SQL is a data oriented language used to select and manipulate sets of data.
PL/SQL is a procedural language used to create applications.

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

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

SQL is declarative, i.e., it tells the database what to do but not how to do it.
Whereas, PL/SQL is procedural, i.e., it tells the database how to do things.

SQL can be embedded within a PL/SQL program.
But PL/SQL can’t be embedded within a SQL statement.

No comments :

Post a Comment