INTRODUCTION
PL/SQL is Oracle procedural language extension to SQL. PL/SQL allows you to mix SQL statements with procedural statements like IF statement, Looping structures etc.
Block Types
Anonymous Block :-
This is a PL/SQL block that executed without name.
eg.,
|
DECLARE
V_DEPARTMENT NUMBER(5);
BEGIN
SELECT "DEPTNO"
INTO V_DEPARTMENT
FROM DEPT_TABLE;
END; |
Named Block :- This is a PL/SQL block that is stored in the database with a name.
eg.,
|
CREATE OR REPLACE PROCEDURE INSERT_DEPTNO AS
V_DEPARTMENT NUMBER(5);
BEGIN
SELECT "DEPTNO"
INTO V_DEPARTMENT
FROM DEPT_TABLE;
END; |
PL/SQL Program Parts
- Declarative Part - Declare variables
- Executable Part - Executable Commands
- Exception-Handling Part - Exception Handler
|
|