Thursday, 13 March 2014

How to Enable PLSQL WARNINGS in Oracle


Purpose: Oracle has improved its PL/SQL warning system in 11g. If we write code like
WHEN OTHERS THEN NULL, it will give warning.

ALTER SESSION SET plsql_warnings = 'enable:all'
/
CREATE OR REPLACE PROCEDURE others_test AS
BEGIN
   RAISE_APPLICATION_ERROR(-20000, 'Force and exception');
EXCEPTION
WHEN OTHERS THEN
       NULL;
END;
This procedure will compile with following warning
PLW-06009: procedure "OTHERS_TEST" OTHERS handler does not end in RAISE or RAISE_APPLICATION_ERROR

No comments:

Post a Comment