Difference between SQL and PL/SQL
There are some points that differentiate both these languages.
- SQL can be embedded within a PL/SQL program. But you can not embedded PL/SQL within a SQL statement. Science PL/SQL is a mixed of SQL statement and procedural structure, you can use procedural language elements such as conditions and loops to group SQL statement. But in SQL, you can't use conditions and loops.
- SQL is a declarative language, it tells the database what to do but not how to do it. Whereas, PL/SQL is procedural language, it tells the database how to do things.
- SQL is a Structured Query Language and allows to execute a single insert/update/delete.
Whereas PL/SQL is a procedural language and can be used to write programs that include 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 allows you to write queries, DDL and DML statements. Whereas PL/SQL is allows you to write program blocks, functions, procedures triggers,and packages.