GeekInterview.com
Series: Subject: Topic:
Question: 29 of 279

User Defined Exception Handler

Suppose a programmer creates a user defined exception handler Invalid_Number in declare block with type EXCEPTION and raise this exception in begin block. Then how will you access the user defined exception and same system defined exception (i.e Inavlid_Number)
Asked by: Subashpanda | Member Since Dec-2010 | Asked on: Feb 7th, 2011

View all questions by Subashpanda   View all answers by Subashpanda

Showing Answers 1 - 1 of 1 Answers
promisinganuj

Answered On : Feb 10th, 2011

View all answers by promisinganuj

The system defined exceptions in Oracle are tied to Oracle error codes. For this case, system defined error INVALID_NUMBER is tied with error code -01722.

Now, when a user defines the same error "INVALID_NUMBER" using EXCEPTION, the SQLCODE is overridden with new value of 1 and SQLERRM as "User-Defined Exception". Later, when this error is raised, the system defined error code can no longer be accessed as it has been changed to 1. You can tie any other error code/message with it by using PRAGMA EXCEPTION_INIT and raise_application_error.

So, as soon as you have declared an exception using EXCEPTION, the system defined error code can no longer be accessed within the scope of that plsql block.

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.