What is an Exception ? What are types of Exception ?

 Exception  is  the  error  handling  part  of  PL/SQL  block. The types are Predefined and user defined. Some of Predefined exceptions are.      CURSOR_ALREADY_OPEN     DUP_VAL_ON_INDEX     NO_DATA_FOUND     TOO_MANY_ROWS     INVALID_CURSOR     INVALID_NUMBER     LOGON_DENIED     NOT_LOGGED_ON     PROGRAM-ERROR     STORAGE_ERROR     TIMEOUT_ON_RESOURCE     VALUE_ERROR     ZERO_DIVIDE     OTHERS.

Showing Answers 1 - 8 of 8 Answers

Surender Rana

  • Jan 24th, 2006
 

Exception is nothing but Error. In PL/SQL block we handle these errors in Exception block.There are two types of exceptions: 1> System define exception and 2> User define exception. System define exception predefine exceptions like 'ZERO_DEVIDE',NO_DATA_FOUND etc.User define exceptions is defined by the user and raise in the excution block and then call into the exception block.

Rana

  • Apr 9th, 2006
 

EXCEPTIONS

 

?         Predefined

Do not declare and allow the Oracle server to raise implicitly

 

NO_DATA_FOUND

TOO_MANY_ROWS

INVALID_CURSOR

ZERO_DIVIDE

INVALID_CURSOR

 

WHEN EXCEPTION THEN ?

 

?         Non predefined

                                         Declare within the declarative section and allow allow Oracle server to raise implicitly

o        SQLCODE ? Returns the numeric value for the seeor code

o        SQLERRM ? Returns the message associated with error number

 

DECLARE -- PRAGMA EXCEPTION_INIT (exception, error_number)

RAISE ? WHEN EXCEPTION_NAME THEN ?

 

?         User defined

                    Declare within the declarative section and raise explicitly.

 

IF confidition the

RAISE EXCEPTION or RAISE_APPLICATION_ERROR

Lavanya Chowdary

  • May 6th, 2007
 

Exception is nothing but error in the PL/SQL program. If any error occured in the PL/SQL program that terminates from the program. To handle that exceptions we are using exception handling part in the PL/SQL
There are three types of exceptions
1. predefined
2. non-predefined
3. user defined

Predefined exceptions are defined by the system we have some predefined exception names to handle some exceptions
non-predefined exceptions are also raised by the system only but we dont have any predefined names we have to trap the exceptions with error code defined by the system
User defined exceptions are defined by the user. He has to declare the exception, he has to raise the exception.

  Was this answer useful?  Yes

samareshp

  • Apr 17th, 2009
 

Hi all, 
Exception is nothing but Error. 

Exception can serve as an ALERT message also. (using RAISE_APPLICATION_ERROR)

There are two types of exceptions:
1> Pre-defineddefine exception (2> User define exception.
System define exception predefine exceptions like 'ZERO_DEVIDE' NO_DATA_FOUND etc.
User define exceptions is defined by the user and raise in the excution block and then call into the exception block.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions