<<Previous Next>>
Oracle - Explain the
concepts of Exception in Oracle - Feb 07, 2010 at 14:20 PM
by Shuchi Gauri
Explain the concepts of Exception in Oracle. Explain its
type.
Exception is the raised when an error occurs
while program execution. As soon as the error occurs, the program
execution stops and the control are then transferred to
exception-handling part.
There are two types of exceptions:
1. Predefined : These types of exceptions are
raised whenever something occurs beyond oracle rules. E.g.
Zero_Divide
2. User defined: The ones that occur based on
the condition specified by the user. They must be raised explicitly
using RAISE statement, unlike pre-defined exceptions that are raised
implicitly.
Oracle -
Explain the concepts of Exception in Oracle - April 10, 2009
at 11:00 AM
Explain the concepts of Exception in
Oracle. Explain its type.
Exceptions in oracle occur when unwanted situations happen during
the execution of a program. They can occur due to system error, user
error or application error. When any of these situations arise, the
control of the program is shifted to Exception section for it to
handle.
Exception can be
Predefined oracle exceptions User-defined
exceptions
To have predefined oracle exception in the code, you have to
start a block of code with the keyword EXCEPTION, followed by when
clause.
Examples of Predefined Exceptions and their description:
No_data_found- It occurs when the single row select statement
returns no data. Too_many_rows- This arises when the single row
select statement returns more than one row. Zero_divide- It
occurs when we try to divide the number by zero. Login_denied- It arises
when a login to Oracle failed because of an invalid username or
password.
Also read
What is Exception in Oracle?, What are the predefined oracle
exceptions?, Explain user defined exceptions in oracle, How PL/SQL
Exceptions Are Raised?............
Define Exceptions in PL/SQL, Explain how to define and raise
exceptions in PL/SQL............
This directs the complier to add the user defined error message
to the oracle error number. It associate the user defined error
message to predefined error codes..........
Raise_application_error allows users to create custom error messages. Syntax:- Raise_application_error
(error_number error_messages);.............
|