PL/SQL Introduction

PL/SQL Introduction:

  •  PL/SQL is the procedural language which is used in oracle platform. 
  •  PL/SQL enables program or Application developers to combine SQL with procedural statements.

 PL/SQL Block contains four sections,

   1. Declare(Optional)

   2. Begin(Mandatory)

   3. Exception(Optional)

   4. End(Mandatory)

Syntax:              

Declare                        

      Declaration statements ;

 Begin

      Executable statements ;

 Exception

     Exception handling statements ;

 End;

 


Example
:     

Declare

    v_count number;

 Begin

       select count(*) into v_count

       from emp;

 Exception

      when SQL%Notfound then

            Dbms_Output.Put_line('No data found');

 End;

 


Explanation
:

Declare:

·       Declare section starts with DECLARE keyword in which constants, variables, cursors can be declared which stores data temporarily.

·       This Declare section is optional.

Execution:

·       Execution section starts with BEGIN and ends with END Keyword. program logic to be written here to perform any task, it support all

·       DDL, DML commands ,condition expressions etc.This section is Mandatory.

Exception:

·       It starts with Exception keyword. which is used to handle the run time errors in the executable section. This section is optional.

PL/SQL Main concepts:

  1. Procedures

  2. Functions

  3. Packages

  4. Triggers

  5. Cursors

  6. Exception handling

 

 


Share:

No comments:

Post a Comment

Popular Posts

Search This Blog

Powered by Blogger.

Blog Archive

Service Support

Need our help to Learn or Post New Concepts Contact me

Blog Archive

Recent Posts

Service Support

Need our help to Learn or Post New Concepts Contact me