Why are Warnings Suppressed when Compiling a Procedure both the DEBUG and PLSQL_WARNINGS Flag (Doc ID 799683.1)

Last updated on APRIL 02, 2009

Applies to:

PL/SQL - Version: 9.2.0.1.0 to 11.1.0.6.0
Information in this document applies to any platform.

Goal

Why are warnings suppressed or not found when compiling a procedure with both the DEBUG and
PLSQL_WARNINGS together?

The following code example demonstrates the behavior:

SQL> CREATE OR REPLACE PROCEDURE dead_code
2 AS
3 x number := 10;
4 BEGIN
5 if x = 10 then
6 x := 20;
7 else
8 x := 100; -- dead code (never reached)
9 end if;
10 END dead_code;
11 /

Procedure created.

SQL> ALTER PROCEDURE dead_code COMPILE PLSQL_WARNINGS = 'ENABLE:ALL' REUSE SETTINGS;

SP2-0805: Procedure altered with compilation warnings

SQL> show errors
-----------------------------------------------------------------
5/12 PLW-06002: Unreachable code
8/9 PLW-06002: Unreachable code

SQL> ALTER PROCEDURE dead_code COMPILE DEBUG PLSQL_WARNINGS = 'ENABLE:ALL' REUSE SETTINGS;

Procedure altered.

SQL> show errors
No errors.
SQL>



Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms