Oracle Database 26ai will be available on generic Linux platforms in January and soon on AIX and Windows
Purpose
The SUPPRESSES_WARNING_6009 suppresses the 6009 PL/SQL warning improving the handling when an exception handler does not use RAISE or RAISE_APPLICATION_ERROR
to raise an active exception.
In some situations, where the application code intentionally calls a handler routine and is not intended to stop processing, the compiler’s default behavior may be too aggressive.
This pragma bypassing the 6009 warning.
Documented
Yes
First Available
20c
Valid Context
PL/SQL Functions, Packages Specifications, Package Bodies, Procedures, Type Specifications, Type Headers
SUPPRESSES_WARNING_6009
PL/SQL 06009 Warning Suppression
PRAGMA SUPPRESS_WARNING_6009(<pls_identifier>);
CREATE OR REPLACE PROCEDURE
except_handler AUTHID DEFINER IS
BEGIN
RAISE_APPLICATION_ERROR(-20000, 'Unexpected error raised');
END except_handler;
/
Procedure created.
CREATE OR REPLACE PROCEDURE app_proc AUTHID DEFINER IS
BEGIN
dbms_output.put_line('In procedure app_proc');
EXCEPTION
WHEN OTHERS THEN
except_handler;
END app_proc;
/
SP2-0804: Procedure created with compilation warnings
SQL> sho err
Errors for PROCEDURE P2:
LINE/COL ERROR
-------- -----------------------------------------------------------------
5/8 PLW-06009: procedure "APP_PROC" OTHERS handler does not end in RAISE
CREATE OR REPLACE PROCEDURE except_handler AUTHID DEFINER IS
PRAGMA SUPPRESSES_WARNING_6009(except_handler);
BEGIN
RAISE_APPLICATION_ERROR(-20000, 'Unexpected error raised');
END except_handler;
/
Procedure created.
CREATE OR REPLACE PROCEDURE app_proc AUTHID DEFINER IS
BEGIN
dbms_output.put_line('In procedure app_proc');
EXCEPTION
WHEN OTHERS THEN
except_handler;
END app_proc;
/