Showing posts with label PLSQL. Show all posts
Showing posts with label PLSQL. Show all posts

what are exception in oracle

Some of the standard Oracle PLSQL Exception are as follow:

1 NO_DATA_FOUND
2 TOO_MANY_ROWS
3 CURSOR_ALREADY_OPEN
4 DUP_VAL_ON_INDEX
5 INVALID_CURSOR
6 INVALID_NUMBER
7 ZERO_DIVIDE

DUP_VAL_ON_INDEX - Attempted to insert a duplicate value

INVALID_CURSOR - Illegal cursor operation occurred

INVALID_NUMBER - Conversion of character string to number
fails

NO_DATA_FOUND - Single row SELECT returned no data

TOO_MANY_ROWS - Single-row SELECT returned more than one row

ZERO_DIVIDE - Attempted to divide by zero

what is the structure of plsql block

DECLARE
             Variable Declaration
              Cursor Declaration 
              User Defined Exception
IS
BEGIN
         Executable Statement
EXCEPTION
        Exception Handling. Action to perform when error occurs. 
END;

Declare Section is optional. Variable and Cursor declaration is defined in declare section.
Executable Statement is defined in Begin Section.
Exception Section is the section where exception can be handled. This is an optional section

difference between procedure and function

Function must return value whereas procedure does not
   
Function can be used in SQL statement whereas procedure can not. Function can be used in SQL statement, if it do not perform any DML operation
   
USER_FUNCTIONS data definition stores function details.
USER_PROCEDURES data definition stores procedure details
   

difference between procedure and function

Function must return value whereas procedure does not
   
Function can be used in SQL statement whereas procedure can not. Function can be used in SQL statement, if it do not perform any DML operation
   
USER_FUNCTIONS data definition stores function details.
USER_PROCEDURES data definition stores procedure details
   

what are build in package available in plsql

1 DBMS_OUTPUT
2 DBMS_SQL
3 DBMS_UTL
4 UTL_FILE
5 DBMS_STANDARD