Quick Search:
 
 The Oracle PL/SQL OTHERS Keyword      [Return To Index] Jump to:  

Term: OTHERS

Definition:
In Oracle PL/SQL, OTHERS is a generic exception name, which can capture any exception and perform a default action. The only restriction associated with the OTHERS exception handler is that it must appear at the end of all other handled exceptions. In Oracle 11g, the warning message PLW-06009 has been introduced the NULL handling of the OTHERS exception.

WHEN OTHERS THEN
NULL;

This error has been defined because this condition makes it possible to bypass serious exceptions without giving any notice. Now, however, the compiler time warning can be enabled to capture the PLW-06009 error.

Example Syntax:

EXCEPTION
WHEN OTHERS THEN
Statement 1
END;


Example Usage:

DECLARE
A NUMBER;
B NUMBER;
C NUMBER;
BEGIN
C := A/B;
EXCEPTION
WHEN ZERO_DIVIDE THEN
C := 0;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLCODE||'\'||SQLERRM);
END;



Related Links:
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org