[go: up one dir, main page]

0% found this document useful (0 votes)
11 views3 pages

Exception Handling in PLSQL

The document discusses exception handling in PL/SQL including syntax, types of exceptions, predefined Oracle server exceptions, trapping non-predefined exceptions, user defined exceptions, and error trapping functions. It provides code examples and discusses implicitly and explicitly raised exceptions.

Uploaded by

msinghbe21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Exception Handling in PLSQL

The document discusses exception handling in PL/SQL including syntax, types of exceptions, predefined Oracle server exceptions, trapping non-predefined exceptions, user defined exceptions, and error trapping functions. It provides code examples and discusses implicitly and explicitly raised exceptions.

Uploaded by

msinghbe21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

10/3/2016

Exception Handling

By
Parteek Bhatia
Assistant Professor
Dept of Comp Sc & Engg
Thapar University
Patiala

Syntax Exception Types


EXCEPTION
There are two types of exceptions:
WHEN exception1 [OR exception2 ………] THEN statement1;
statement2; Implicitly raised exceptions
[WHEN exception3 [OR exception4 ………] THEN statement1;
statement2;
Explicitly raised exceptions
..…………..]
[WHEN OTHERS THEN
statement1;
statement2;
……..]
END;

Implicitly raised exceptions Some of Predefined Oracle Server

Predefined Oracle Server NO_DATA_FOUND


Non-predefined Oracle Server TOO_MANY_ROWS
DUP_VAL_ON_INDEX
ZERO_DIVIDE
INVALID_NUMBER

1
10/3/2016

Trapping of Non-predefined Oracle Server

To show use of User Defined System Exceptions


Syntax

Declare
Exception_name EXCEPTION;
PRAGMA EXCEPTION_INIT (exception_name, error_number);

Trapping of Explicitly raised or User Syntax


defined exceptions
Declare
Exception_name EXCEPTION;
Begin
...
If condition Then
RAISE exception_name;
End if;

Exception
When exception_name then
….
End;

2
10/3/2016

User defined exception Error Trapping Functions

Error Trapping Functions Error Trapping Functions

Thanks

Lets Implement it in Lab Session

You might also like