Skip to main content

Getting started with PLSQL

PLSQL Basics


Structure of PLSQL Block


Declare                      (Optional)
BEGIN                      (Required)
       Sql statments
       IF....While...For....Else....Do....While
Exception                  (Optional)
End ;                       (Mandatory)


Types of blocks in PLSQL


1. Anonymous

Structure :

Declare                      (Optional)
BEGIN                      (Required)
       Sql statments
       IF....While...For....Else....Do....While
Exception                  (Optional)
End                            (Required)



2. Procedure

Structure


Procedure name
Is
Declare                      (Optional)
BEGIN                      (Required)
       Sql statments
       IF....While...For....Else....Do....While
Exception                  (Optional)
End ;                   (Required)



3. Function

Structure

Function nam
Return datatype
Is
Declare                      (Optional)
BEGIN                      (Required)
       Sql statments
       IF....While...For....Else....Do....While
       Return value;
Exception                  (Optional)
End;                            (Required)












Comments