WHAT IS PL/SQL
pl/sql is the procedural implementation of sql i.e. u can pass sqlstatements in procedural format using pl/sql. Normal sql does not haveany procedural capabilities moreover u can only pass one statement ata time to Oracle Engine. Hence, pl/sql have come up to avoid thislimitation. Hence, pl/sql is the structured programming language fororacle. It's structure is very much similar to any other procedurallanguage such as C or C++
I won't waste your time in typing out the advantages of pl/sql ... u caneasily find out in a book.
The pl/sql block contains the following section:-------The DECLARE section.-----The Master BEGIN and END section that contains the EXCEPTIONsection.The declare section contains declaration of memory variables,constants, cursors etc. The begin section contains sql executablestatements and pl/sql executable statements. The exception sectioncontains code to handle errors that may arise during the execution of the code block. The end declares the end of pl/sql block.
A bit about it's working. When you typed out the pl/sql block forexecution. It is sent to the pl/sql engine, whee procedural statementsare executed; and sql statements are sent to the sql executor in theoracle engine. Since pl/sql engine resides in the oracle engine, thecodes executes smoothly and efficiently.
This is easy since it includes almost all the data types which u haveused in sql such as date, varchar, number, char etc etc... Some of theattributes such as %TYPE is also used. This attribute automaticallytakes in the default datatype of the sql table from which u have passedthe query. We will discuss this later.