Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle PL/SQL OTHERS Keyword      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

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      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 318 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?