Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







PL/SQL re-raise exception tips

Oracle PL/SQL tips by Boobal Ganesan

This is an excerpt from the book Advanced PL/SQL: The Definitive Reference by Boobal Ganesan.

An exception can be re-raised either to pass the control of the exception to the enclosing block or to log the error into a table and then raise it to an application or to a user. To re-raise an exception, the command RAISE has to be placed in the exception section after the logging of the information is done.


% Note: The exception name can be optionally placed after the RAISE command.

In the below example, the exception ZERO_DIVIDE is logged into a table right before it is re-raised to the user or to the application.




3.  l_n_var1 NUMBER;


5.  L_n_var1:= 1/0;


7.  WHEN zero_divide THEN

8.  INSERT INTO log_table VALUES (log_seq.nextval,SQLCODE ||' '||sqlerrm);

9.  raise;

10. END;

11. /

Script Explanation:

Line No.



This environment variable opens up an output buffer of size limit of 200000.


Start of the declaration section of the block.


A local variable l_n_var1 of the number data type is declared.


Start of the execution section of the block.


The integer 1 is divided by the integer 0 and is assigned to the variable l_n_var1.


Start of the exception section of the block.


A when clause handling the predefined exception zero_divide is defined.


The error code (SQLCODE) and the error message (SQLERRM) values are logged into a table.


The exception raise is re-raised using the RAISE statement.


End of the exception section of the block.


Need to learn to program with PL/SQL?  For complete notes on programming in PL/SQL, we recommend the book Advanced PL/SQL: The Definitive Reference by Boobal Ganesan.

This is a complete book on PL/SQL with everything you need to know to write efficient and complex PL/SQL code.

Oracle Training from Don Burleson 

The best on site "Oracle training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!

Oracle training


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster