Oracle PRAGMA SUPPRESSES_WARNING_6009
Version 21c

General Information
Library Note Morgan's Library Page Header
Which has the higher priority in your organization: Deploying a new database or securing the ones you already have? Looking for a website, and resources, dedicated solely to securing Oracle databases? Check out DBSecWorx.
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;
/

Procedure created.

Related Topics
Built-in Functions
Built-in Packages
Database Security
Pragmas
PRAGMA AUTONOMOUS_TRANSACTION
PRAGMA COVERAGE
PRAGMA DEPRECATE
PRAGMA EXCEPTION_INIT
PRAGMA INLINE
PRAGMA SERIALLY_REUSABLE
PRAGMA SUPPLEMENTAL_LOG_DATA
What's New In 21c
What's New In 23c

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2023 Daniel A. Morgan All Rights Reserved
  DBSecWorx