Concepts of Exception in Oracle

          

Explain the concepts of Exception in Oracle

<<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
Oracle error handling

What is Exception in Oracle?, What are the predefined oracle exceptions?, Explain user defined exceptions in oracle, How PL/SQL Exceptions Are Raised?............

Oracle Exceptions

Define Exceptions in PL/SQL, Explain how to define and raise exceptions in PL/SQL............

What is Pragma Init Exception in oracle?

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..........

What is Raise_application_error in oracle?

Raise_application_error allows users to create custom error messages. Syntax:- Raise_application_error (error_number error_messages);.............

<<Previous  Next>>



Write your comment - Share Knowledge and Experience


 

 
Interview questions
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us | We are hiring