«Back to Home

Oracle Jump Start

Topics

PLSQL Block Structure in OraclePLSQL

Introduction

Anonymous Blocks
 
Anonymous block is a block without a name. These blocks are declared at the point in an Application, where they are to be run and passed to PL/SQL engine for the execution at the run-time.
 
The structure of an anonymous block is as follows-
         Declare
               <Declarations>
         Begin   
               <Executable statements>
         Exception
               <Exception handlers>
         END;

3

Declaration
 
Contains all the variables, constants, cursor and user-defined exceptions, which will be referenced within the executable section. This section is optional.
 
Executable section
 
Contains SQL statements to manipulation the data in the database and PL/SQL statement to manipulate the data in the block. This section is mandatory.
 
Exception handling section
 
Specifically, the actions to perform, when the errors and abnormal conditions arise within the executable section. This section is again optional.
 
Sub-program
 
These are named PL/SQL blocks. They may be declared as procedures, functions or packages.
 
Summary
 
In this article, you learnt, PL/SQL block structure in Oracle/PLSQL