GeekInterview.com
Series: Subject: Topic:
Question: 470 of 492

What is Pragma EXECPTION_INIT ? Explain the usage ?

 The PRAGMA EXECPTION_INIT tells the complier to associate an exception with an oracle error. To get an error message of a specific oracle error.      e.g. PRAGMA EXCEPTION_INIT (exception name, oracle error number)
Asked by: Interview Candidate | Asked on: Sep 9th, 2004
Showing Answers 1 - 3 of 3 Answers

Pragma exception_init  Allow you to handle the Oracle predefined message by you'r own message. means you can instruct compiler toassociatethe specific message to oracle predefined message at compile time.This way you Improve the Readbility of your program,and handle it accoding to your own way.It should be declare at the DECLARE section.exampledeclaresalary number;FOUND_NOTHING exception;Pragma exception_init(FOUND_NOTHING ,100);beginselect sal in to salaryfrom emp where ename ='ANURAG';dbms_output.put_line(salary);exceptionWHEN FOUND_NOTHING THENdbms_output.put_line(SQLERRM);end;

Yes  2 Users have rated as useful.
  
Login to rate this answer.
g_sidhu

Answered On : Jan 31st, 2008

PRAGMA EXCEPTION_INIT statement associate the declared exception with the standard Oracle server error number. PRAGMA EXCEPTION_INIT tells the compiler to associate an exception name with an Oracle error number. That allows you to refer to any internal exception by name and to write a specific handler for it.PRAGMA (also called pseudoinstructions) is the keyword that signifies that the statement is a compiler directive, which is not processed when the PL/SQL block is executed. Rather, it directs the PL/SQL compiler to interpret all occurrences of the exception name within the block as the associated Oracle server error number.SyntaxPRAGMA EXCEPTION_INIT(exception, error_number);

  
Login to rate this answer.
Devendra Tawar

Answered On : Apr 27th, 2011

View all answers by Devendra Tawar

Use for handle user defined exception.

  
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.