What is PL/SQL and what is it used for?
SQL is a declarative language that allows database programmers to write a SQL declaration and hand it to the database for execution. As such, SQL cannot be used to execute procedural code with conditional, iterative and sequential statements. To overcome this limitation, PL/SQL was created. PL/SQL is Oracle’s Procedural Language extension to SQL. PL/SQL’s language syntax, structure and data types are similar to that of Ada. Some of the statements provided by PL/SQL: Conditional Control Statements: • IF … THEN … ELSIF … ELSE … END IF; • CASE … WHEN … THEN … ELSE … END CASE; Iterative Statements: • LOOP … END LOOP; • WHILE … LOOP … END LOOP; • FOR … IN [REVERSE] … LOOP … END LOOP; Sequential Control Statements: • GOTO …; • NULL; The PL/SQL language includes object oriented programming techniques such as encapsulation, function overloading, information hiding (all but inheritance). PL/SQL is commonly used to write data-centric programs to manipulate data in a