Oracle PL/SQL Warnings
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.
Constants
Name Data Type Values
WARNING_CATEGORY VARCHAR2
ALL PERFORMANCE
INFORMATIONAL SEVERE
WARNING_VALUE VARCHAR2
DISABLE ERROR
ENABLE  
SCOPE VARCHAR2
SESSION SYSTEM
Data Dictionary Objects
ALL_PLSQL_OBJECT_SETTINGS DBA_PLSQL_OBJECT_SETTINGS DBMS_WARNING_INTERNAL
ALL_WARNING_SETTINGS DBA_WARNING_SETTINGS USER_PLSQL_OBJECT_SETTINGS
CDB_PLSQL_OBJECT_SETTINGS DBMS_PLSQL_WARNING_LIB USER_WARNING_SETTINGS
CDB_WARNING_SETTINGS DBMS_WARNING WARNING_SETTINGS$
First Available 10.1
Initialization Parameter PLSQL_WARNINGS
Current Warning Status set linesize 121
col name format a30
col value format a30

SELECT name, value
FROM gv$parameter
WHERE name LIKE 'plsql%warn%';
 
Syntax and Usage
Basic Examples PLSQL_WARNINGS = '<DISABLE | ENABLE | ERROR>:<ALL | INFORMATIONAL | PERFORMANCE | SEVERE>'

PLSQL_WARNINGS = 'DISABLE:<warning#>'ENABLE:<warning#>', 'ERROR:<warning#>'
col value format a80

ALTER SESSION SET PLSQL_WARNINGS='DISABLE:ALL';

SELECT value FROM v$parameter WHERE name = 'plsql_warnings';

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:INFORMATIONAL';

SELECT value FROM v$parameter WHERE name = 'plsql_warnings';

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:PERFORMANCE';

SELECT value FROM v$parameter WHERE name = 'plsql_warnings';

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:SEVERE';

SELECT value FROM v$parameter WHERE name = 'plsql_warnings';

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

SELECT value FROM v$parameter WHERE name = 'plsql_warnings';

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:SEVERE', 'DISABLE:INFORMATIONAL';

SELECT value FROM v$parameter WHERE name = 'plsql_warnings';

ALTER SESSION SET PLSQL_WARNINGS = 'DISABLE:5000', 'ENABLE:5001', 'ERROR:5002';

SELECT value FROM v$parameter WHERE name = 'plsql_warnings';

ALTER SESSION SET PLSQL_WARNINGS = 'ENABLE:(5004,6002,7206)', 'DISABLE:(5000,5003,7203)';

SELECT value FROM v$parameter WHERE name = 'plsql_warnings';
 
Severe Warning Messages (5000-5999)
PLW-05000 Mismatch in NOCOPY qualification between specification and body
The indicated parameter was declared with the NOCOPY hint in the subprogram specification but not in the body, or it was declared with the NOCOPY hint in the body but not in the specification.
ALTER SESSION SET PLSQL_WARNINGS='DISABLE:ALL';

CREATE OR REPLACE PACKAGE plwpk IS
  PROCEDURE p(param OUT NOCOPY VARCHAR2);
END plwpk;
/

CREATE OR REPLACE PACKAGE BODY plwpk IS
  PROCEDURE p(param OUT NOCOPY VARCHAR2) IS
BEGIN
   param := 'test';
END p;
END plwpk;
/

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

CREATE OR REPLACE PACKAGE BODY plwpk IS
 PROCEDURE p(param OUT VARCHAR2) IS
 BEGIN
   param := 'test';
 END p;
END plwpk;
/

sho err
PLW-05001 Previous use of 'string' (at line string) conflicts with this use
While looking for prior declarations of a variable or constant, the compiler found another object with the same name in the same scope, or, the headers of subprogram in a package specification and body are not identical.
TBD
PLW-05003 Same actual parameter(string and string) at IN and NOCOPY may have side effects
The indicated parameter was declared with the NOCOPY hint in the subprogram specification but not in the body, or it was declared with the NOCOPY hint in the body but not in the specification.
TBD
PLW-05004 Identifier string is also declared in STANDARD or is a SQL builtin
The indicated identifier was also either:
  • declared in package STANDARD
  • a SQL built-in function
  • a pseudo-column.
This situation can result in name resolution issues since the STANDARD/builtin declaration will be chosen over the local declaration in SQL statements; however the local declaration will be chosen over the STANDARD/builtin declaration outside SQL scope.
ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

-- test a function
CREATE OR REPLACE PROCEDURE plw05004 IS
 a varchar2(20);
 -- same declaration as in SQL dbms_standard
 FUNCTION trim(v IN VARCHAR2) RETURN VARCHAR2 IS
 BEGIN
   RETURN v;
 END;
BEGIN
  a := TRIM(' X ');
END plw05004;
/

-- test a SQL built-in
CREATE OR REPLACE PROCEDURE plw05004 IS
 n NUMBER;
 FUNCTION sqrt(n IN NUMBER) RETURN NUMBER IS
 BEGIN
  RETURN 1;
 END;
BEGIN
  n := sqrt(1);
END plw05004;
/

-- test a pseudocolumn
CREATE OR REPLACE PROCEDURE plw05004 IS
 rowid BOOLEAN := TRUE;
BEGIN
  IF rowid THEN
    NULL;
  END IF;
END plw05004;
/


sho err
PLW-05005 Function string returns without value at line string
The function exited without a return value. Return statements are required for all PL/SQL functions.
ALTER SESSION SET PLSQL_WARNINGS='DISABLE:ALL';

CREATE OR REPLACE FUNCTION plw05005 RETURN VARCHAR2 IS
BEGIN
  RETURN 'A';
EXCEPTION
  WHEN OTHERS THEN
    NULL;
END plw05005;
/

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

CREATE OR REPLACE FUNCTION plw05005 RETURN VARCHAR2 IS
BEGIN
  RETURN 'A';
EXCEPTION
  WHEN OTHERS THEN
    NULL;

END plw05005;
/

sho err
PLW-05006 Shadow type generation resulted in warning string
Compilation of a table function causes the creation of internally- generated types. A problem occurred during creation of these types which was not severe enough to prevent the creation of the types, but which may impact the usage of the table function.
TBD
PLW-05007 First parameter to pragma INLINE must be an identifier
The first parameter to the pragma INLINE must be an identifier denoting a procedure or function.
TBD
PLW-05008 Illegal number of arguments for pragma string
The number of arguments (actual parameters) passed to the named pragma (compiler directive) is incorrect. A required argument was omitted from the argument list, or the pragma syntax is faulty (for example, a comma might be missing between two parameters).
I have tried numerous times to generate this warning without success. In every case the compiler throws a full exception due to the syntax being invalid.
PLW-05009 Pragma INLINE may not appear in a declaration list
Pragma INLINE applies only to the following statement, and can not appear immediately prior to a declaration.
TBD
PLW-05010 Duplicate pragma INLINE on procedure 'string'
Pragma INLINE was applied twice to the same procedure in the same statement. The procedure will be inlined only if all duplicates specify a control value of 'YES'.
TBD
PLW-05011 Pragma INLINE for procedure 'string' does not apply to any calls
A pragma INLINE was provided, but there was no call to the mentioned procedure in the next statement.
CREATE OR REPLACE PROCEDURE plw05011 AUTHID DEFINER IS
BEGIN
  PRAGMA INLINE('A', 'YES');
  NULL;
END plw05011;
/

sho err
PLW-05012 Pragma INLINE for procedure 'string' could not be applied
A pragma INLINE(<name>, 'yes') was used, but the named procedure could not be inlined.
TBD
PLW-05013 Second parameter to pragma INLINE 'string' is not 'YES' or 'NO'
The second parameter to the pragma INLINE governs whether or not a procedure call can be inlined. The only legal values are 'YES', meaning that the compiler should attempt to inline the call, and 'NO', meaning that the compiler must not inline the call.
CREATE OR REPLACE PROCEDURE plw05013 AUTHID DEFINER IS
 l_loops  NUMBER := 100000;
 l_start  NUMBER;
 l_return NUMBER;

FUNCTION add_numbers(p_1 IN NUMBER, p_2 IN NUMBER) RETURN NUMBER AS
BEGIN
  RETURN p_1 + p_2;
END add_numbers;


BEGIN
  l_start := dbms_utility.get_time;

  FOR i IN 1 .. l_loops LOOP
    PRAGMA INLINE (add_numbers, 'notYESorNO');
    l_return := add_numbers(1, i);
  END LOOP;

  dbms_output.put_line('Elapsed Time: ' || (dbms_utility.get_time - l_start) || ' hsecs');
END plw05013;
/

sho err
PLW-05014 Pragma string cannot be specified here
The pragma was specified in an inappropriate context.
TBD
PLW-05015 Implementation restriction - too many debug records
The program is so large that it overflowed a compiler limit on the size of the debug symbol table. The module was compiled with partial debugging information.
TBD
PLW-05016 INTO clause should not be specified here
The INTO clause was incorrectly specified on a cursor declaration. It should have been specified on the FETCH statement.
ALTER SESSION SET PLSQL_WARNINGS='DISABLE:ALL';

CREATE OR REPLACE PROCEDURE plw05016 AS
 t VARCHAR2(30);

 CURSOR c IS
 SELECT table_name
 INTO t
 FROM all_all_tables;
BEGIN
  NULL;
END plw05016;
/

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

CREATE OR REPLACE PROCEDURE plw05016 AUTHID DEFINER IS
 t VARCHAR2(30);

 CURSOR c IS
 SELECT table_name
 INTO t
 FROM all_all_tables;
BEGIN
  OPEN c;
  CLOSE c;
END plw05016;
/

sho err
PLW-05017 Prefix of the expression will be ignored
Generalized invocation with explicit SELF and a dotted name was used to call the type method causing the prefix of the dotted name to be ignored.
TBD
PLW-05018 Package, procedure, function, or PL/SQL type does not contain the AUTHID clause
Unit omitted optional AUTHID clause; default value DEFINER used.This warning is a generic reminder to explicitly define AUTHID
CREATE OR REPLACE PROCEDURE plw05018 IS
BEGIN
  NULL;
END;
/

sho err
PLW-05019 Language element 'string' is deprecated in the indicated version
The language element near keyword string is deprecated beginning with version string. A deprecated language element was used. The particular language element is deprecated in PL/SQL versions greater than or equal to the version number given in the message text.
CREATE OR REPLACE PACKAGE plw05019 AUTHID DEFINER AS
  FUNCTION test(val IN NUMBER) RETURN NUMBER;
  PRAGMA RESTRICT_REFERENCES (test, WNDS, RNPS);
END plw05019;
/

sho err
PLW-05020 Parameter name must be an identifier
A string literal was used as the parameter name in a call that used named notation.
CREATE OR REPLACE PROCEDURE child (parm IN VARCHAR2) AUTHID CURRENT_USER IS
BEGIN
  NULL;
END;
/

CREATE OR REPLACE PROCEDURE plw05020 AUTHID CURRENT_USER IS
BEGIN
  child('parm' => 'ABC');
END;
/

sho err
PLW-05021 Exception <exception_name> does not have a pragma
A user defined exception was created but not mapped to a pragma. I can see this warning as a real pain unless disabled which I do in my setup glogin.sql.
CREATE OR REPLACE PROCEDURE plw05021 AUTHID DEFINER IS
 FieldsLeftNull EXCEPTION;
BEGIN
  NULL;
END plw05021;
/

sho err
PLW-05022 Argument 'string' is not comparable
An argument to either IN, BETWEEN or MEMBER OF was not of a comparable type. Or, if the argument was of an object type, no MAP or ORDER method was specified for the type.
-- multiple attempts to produce this warning message have failed. Here is one of them.

conn scott/tiger@pdbdev

CREATE OR REPLACE TYPE InStrTab IS TABLE OF VARCHAR(2);
/

CREATE OR REPLACE PROCEDURE plw05022 AUTHID DEFINER IS
 i PLS_INTEGER;
 x InStrTab := InStrTab(10,30, 'A');
BEGIN
  SELECT COUNT(*)
  INTO i
  FROM emp
  WHERE deptno MEMBER OF (x);

  dbms_output.put_line(i);
END plw05022;
/
PLW-05023 PL/Scope is disabled because SYSAUX is offline
PL/Scope was disabled for the current PL/SQL unit compilation because the SYSAUX tablespace is or was offline at the time of compilation.
TBD
PLW-05024 Do not use BULK COLLECT clause in a cursor declaration
A BULK COLLECT clause was specified in a cursor declaration.
CREATE OR REPLACE PROCEDURE plw05024 AUTHID DEFINER AS
 TYPE at_type IS TABLE OF all_all_tables.table_name%TYPE;
 at_array at_type;

 CURSOR c IS
 SELECT table_name
 BULK COLLECT INTO at_array
 FROM all_all_tables;
BEGIN
  OPEN c;
  CLOSE c;
END plw05024;
/

sho err
PLW-05025 Do not refer to formal parameter string from this same subprogram declaration
The default expression of a formal parameter referred to another formal parameter from the same subprogram declaration. This is only permitted in a formal %CHARSET expression. Action: Remove the reference.
TBD
PLW-05026 Identifier 'string' should not be specified on the END statement for an unlabeled construct
There was either a missing semicolon on the END statement or no label was specified on the construct. The END statements which terminate some language constructs (such as loop, block, if and case) may optionally be qualified with the label of that construct. For example, the loop construct <L> LOOP loop-body may be completed with END LOOP L.

Action: Ensure that the statement has a label or that the END statement is properly terminated by a semicolon.
TBD
PLW-05027 END statement identifier 'string' should match label 'string' at line string, column string
There was either a missing semicolon on the END statement or the name following the END statement was misspelled. The END statements which terminate some language constructs (such as loop, block, if and case) may optionally be qualified with the label of that construct. For example, the loop construct <L> LOOP loop-body may be completed with END LOOP L.

Action: Ensure that the spelling of the END statement identifier matches the label specified for the language construct or that the END statement is properly terminated with a semicolon.
TBD
PLW-05028 END statement identifier 'string' should match the name of TRIGGER 'string'.
The name on the END statement completing a TRIGGER definition was misspelled.

Action: Ensure that the spelling of the END statement identifier matches the name specified for the TRIGGER definition.
TBD
PLW-05029 Statement has more than one label specified for it.
Cause: More than one label was specified for a statement. This can lead to confusion when reading or updating code.
Action: Remove the additional labels.
TBD
PLW-05999 Implementation restriction (may be temporary) string
TBD
 
Informational Warning Messages (6000-6249)
PLW-06002 Unreachable code
Static program analysis determined that some code on the specified line would never be reached during execution. This may come as a result of expression evaluation at compile time.
ALTER SESSION SET PLSQL_WARNINGS='DISABLE:ALL';

SQL> CREATE OR REPLACE PROCEDURE plw06002 AUTHID DEFINER AS
  2   x NUMBER := 10;
  3  BEGIN
  4    IF x = 10 THEN
  5      x := 20;
  6    ELSE
  7      x := 100;
  8    END IF;
  9  END plw06002;
 10  /

Procedure created.

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

SQL> CREATE OR REPLACE PROCEDURE plw06002 AUTHID DEFINER AS
  2   x NUMBER := 10; -- x can never have any value other than 10
  3  BEGIN
  4    IF x = 10 THEN
  5      x := 20;
  6    ELSE        
  7      x := 100;
  8    END IF;
  9  END plw06002;
 10  /
SP2-0804: Procedure created with compilation warnings

SQL> sho err
Errors for PROCEDURE DEAD_CODE:

LINE/COL ERROR
-------- ----------------------
7/5 PLW-06002: Unreachable code

SQL> CREATE OR REPLACE NONEDITIONABLE PROCEDURE plw06002 AUTHID DEFINER IS
  2   installDBID CONSTANT NUMBER := 1262297360;
  3   x                    NUMBER;
  4   invalidDBID EXCEPTION;
  5  BEGIN
  6    SELECT dbid INTO x FROM v$database;
  7    IF installDBID <> installDBID THEN  -- x isn't being tested this condition is always TRUE
  8      RAISE invalidDBID;
  9    END IF;
 10 END plw06002;
 11 /
SP2-0804: Procedure created with compilation warnings

SQL> sho err
Errors for PROCEDURE PLW06002:

LINE/COL ERROR
-------- -----------------------------------------------------------------
9/1 PLW-06002: Unreachable code
PLW-06002 with Wrapped Code ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

CREATE OR REPLACE PROCEDURE plw06002 wrapped
a000000
b2
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
7
6d a2
ASXzD4E60Xyv09790pDE+Doltlcwg5nnm7+fMr2ywFwWhT54fIJ8fAmldIsJ42mlmYEywLIl
fD3DS8JcfCF8S4vAwDL+0oYJaef+pdJSROVL+73Vzs74W6ZElKnhcAI8Z0oKT5lUaOyZ256l
vVv9ftempqqKBBE=
/

sho err
PLW-06003 Unknown inquiry directive 'string'
An unknown inquiry directive was used. The inquiry directive is neither predefined nor user-defined.
CREATE OR REPLACE PROCEDURE plw06003 IS
BEGIN
  dbms_output.put_line('I am: ' || $$plsql_unit);
END plw06003;
/

CREATE OR REPLACE PROCEDURE plw0603 IS
BEGIN
  dbms_output.put_line('I am: ' || $$plsql_unitzz);
END plw06003;
/

sho err
PLW-06004 Inlining of call of procedure 'string' requested
A pragma INLINE(, 'YES') referring to the named procedure was found. The compiler will, if possible, inline this call.
TBD
PLW-06005 Inlining of call of procedure 'string' was done
A call to the procedure was inlined.
CREATE OR REPLACE TYPE t_airplanes_row AUTHID CURRENT_USER AS OBJECT (
program_id     VARCHAR2(3),
line_number    NUMBER(10),
customer_id    VARCHAR2(4),
order_date     DATE,
delivered_date DATE);
/

CREATE OR REPLACE TYPE t_airplanes_tab AS TABLE OF t_airplanes_row;
/

CREATE OR REPLACE PACKAGE cache_demo AUTHID CURRENT_USER AS
 l_tab t_airplanes_tab;
 PROCEDURE populate_cache;
 FUNCTION get_airplanes RETURN t_airplanes_tab;
END cache_demo;
/

CREATE OR REPLACE PACKAGE BODY cache_demo AS
 PROCEDURE populate_cache AS
 BEGIN
   SELECT t_airplanes_row(program_id, line_number,
   customer_id, order_date, delivered_date)
   BULK COLLECT INTO l_tab
   FROM airplanes
   WHERE rownum < 50001;
 END;
 ------------------------------------------------
 FUNCTION get_airplanes RETURN t_airplanes_tab AS
 BEGIN
   RETURN l_tab;
 END;
BEGIN
  populate_cache;
END cache_demo;
/

SP2-0810: Package Body created with compilation warnings

SQL> SHO ERR
Errors for PACKAGE BODY CACHE_DEMO:

LINE/COL
------------------------------------------------------------------
ERROR
------------------------------------------------------------------
16/3
PLW-06005: inlining of call of procedure 'POPULATE_CACHE' was done
PLW-06006 Uncalled procedure 'string' is removed
Static program analysis determined that the procedure can never be called or executed. Therefore, it has been removed to save time during compilation and space during execution.
ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

CREATE OR REPLACE PROCEDURE plw06006 AUTHID DEFINER IS
 t VARCHAR2(30);

 CURSOR c IS
 SELECT table_name
 FROM all_all_tables;
BEGIN
  NULL;
END plw06006;
/

sho err
PLW-06007 Procedure 'string' is removed because optimization removed calls
Static program analysis determined that the procedure can never be called or executed. Therefore, it has been removed to save time during compilation and space during execution.
TBD
PLW-06008 Call of procedure 'string' will not be inlined
A pragma INLINE(, 'NO') referring to the named procedure was found. The compiler is prevented from inlining this call.
TBD
PLW-06009 Procedure 'string' OTHERS handler does not end in RAISE or RAISE_APPLICATION_ERROR
The OTHERS handler can exit without executing some form of RAISE or or a call to the standard procedure RAISE_APPLICATION_ERROR.
CREATE OR REPLACE PROCEDURE plw06009 AUTHID DEFINER IS
 CURSOR c IS
 SELECT table_name
 FROM all_all_tables;
BEGIN
  OPEN c;
  CLOSE c;
EXCEPTION
  WHEN OTHERS THEN
    NULL;
END plw06009;
/

sho err
PLW-06010 Keyword 'string' used as a defined name
A PL/SQL or SQL keyword was used as defined name. Although legal, this is not recommended.
ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

CREATE OR REPLACE PROCEDURE string AUTHID DEFINER IS
BEGIN
  NULL;
END string;
/

sho err
PLW-06011 Detailed dependency information discarded due to size limitations
The compiled unit was so large that the compiler could not store detailed dependency information that could be used to quickly recompile the unit if it was invalidated.
TBD
PLW-06012 SQL statement cannot be inlined. string
The SQL statement could not be inlined.
TBD
PLW-06013 Deprecated parameter PLSQL_DEBUG forces PLSQL_OPTIMIZE_LEVEL <= 1
The PLSQL_DEBUG parameter was set to TRUE forcing the optimization level to 1 (or 0 if the user selected 0) regardless of the setting of the PLSQL_OPTIMIZE_LEVEL parameter to a higher level
show parameter level

ALTER SESSION SET PLSQL_DEBUG=TRUE
;

CREATE OR REPLACE PROCEDURE plw06013 AUTHID DEFINER IS
 CURSOR c IS
 SELECT *
 FROM all_all_tables;
BEGIN
  FOR r IN c LOOP
    r.table_name := SUBSTR(r.table_name,1,1);
  END LOOP;
END plw06013;
/

sho err
PLW-06014 PLSQL_OPTIMIZE_LEVEL <= 1 turns off native code generation
Native code generation was not done because the optimization was set to 1 or less.
SELECT DISTINCT owner, plsql_optimize_level
FROM dba_plsql_object_settings;

ALTER SESSION SET plsql_optimize_level = 1;

SELECT DISTINCT owner, plsql_optimize_level
FROM dba_plsql_object_settings;

ALTER SESSION SET plsql_compiler_flags = 'NATIVE';

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

CREATE OR REPLACE FUNCTION plw06014 RETURN VARCHAR2 IS
BEGIN
  RETURN 'A';
END plw06014;
/

sho err

ALTER SESSION SET plsql_optimize_level = 2;

ALTER SESSION SET plsql_compiler_flags = 'INTERPRETED';
PLW-06015 Parameter PLSQL_DEBUG is deprecated; use PLSQL_OPTIMIZE_LEVEL = 1
The PLSQL_DEBUG parameter was specified.
show parameter level

ALTER SESSION SET PLSQL_DEBUG=TRUE;

CREATE OR REPLACE PROCEDURE plw06015 IS
 CURSOR c IS
  SELECT *
  FROM all_all_tables;
BEGIN
  FOR r IN c LOOP
    r.table_name := SUBSTR(r.table_name,1,1);
  END LOOP;
END plw06015;
/

sho err
PLW-06016 Unit string is too large; native code generation turned off
Because the program was extremely large, analysis took an excessive amount of time or space to complete causing native compilation to be turned off.
TBD
PLW-06017 An operation will raise an exception
An operation near this location is certain to raise an exception during execution; it may be a programming error because it is not an explicit RAISE.
-- the signtype data type can only handle the values -1, 0, and +1

CREATE OR REPLACE FUNCTION plw6017f RETURN SIGNTYPE AUTHID DEFINER IS
BEGIN
  RETURN 42;
END plw6017f;
/

sho err

CREATE OR REPLACE PROCEDURE plw6017p AUTHID DEFINER IS
 x VARCHAR2(20);
BEGIN
  x := 'ABCDEFGHIJKLMNOPQRSTUVXXYZ';
END plw6017p;
/

sho err
PLW-06018 An infinity or NaN value is computed or used
An operation near this location computes or uses an infinite NUMBER, BINARY_FLOAT, or BINARY_DOUBLE value or a NaN BINARY_FLOAT or BINARY_DOUBLE value.
TBD
PLW-06019 Entity string is deprecated
The entity was deprecated and could be removed in a future release.
SQL> CREATE OR REPLACE PACKAGE plw06019a AUTHID DEFINER IS
  2   PRAGMA DEPRECATE(pragma_dep);
  3   PROCEDURE foo;
  4   PROCEDURE bar;
  5  END plw06019a;
  6  /

SP2-0808: Package created with compilation warnings

SQL> sho err
Errors for PACKAGE PLW06019A:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/8 PLW-06021: PRAGMA DEPRECATE on PRAGMA_DEP is misplaced
PLW-06020 Reference to a deprecated entity: declared in unit
The referenced entity was deprecated and could be removed in a future release. Do not use the deprecated entity. Follow the specific instructions in the warning if any are given.
-- the following PL/SQL was extracted from a PL/SQL package

FUNCTION whichVersion RETURN SIGNTYPE DETERMINISTIC IS
 retVal SIGNTYPE := -1;
 verVal VARCHAR2(12);
 compat VARCHAR2(12);

 wrongVer EXCEPTION;
 wrongCP EXCEPTION;
BEGIN
  dbms_utility.db_version(verVal, compat);
  IF TO_NUMBER(SUBSTR(verVal,1,2)) < 18 THEN
    RAISE wrongVer;
  END IF;

  IF TO_NUMBER(SUBSTR(compat,1,2)) < 18 THEN
    RAISE wrongCP;
  END IF;

  writelog(3, 'Target Database Version Is ' || verVal);
  writelog(3, 'Target Database Compatible Parameter Is Set To ' || compat);
  RETURN 1;
EXCEPTION
  WHEN wrongVer THEN
    writelog(3, 'ORA-20003: Database Is Version ' || verVal || ' And Must Be At Least 18.0 To Proceed');
    RETURN retVal;
  WHEN wrongCP THEN
    writelog(3, 'ORA-20003: Database Compatible Parameter Is Set To ' || compat || ' And Must Be At Least 18.0 To Proceed');
    RETURN retVal;
  WHEN OTHERS THEN
    writelog(3, 'ORA-20603: Untrapped Error In Function whichDB');
    RETURN retVal;
END whichVersion;

SP2-0810: Package Body created with compilation warnings

SQL> sho err
Errors for PACKAGE BODY UTL_PROXY:

LINE/COL ERROR
-------- -----------------------------------------------------------------
109/3 PLW-06020: reference to a deprecated entity: DB_VERSION declared
in unit DBMS_UTILITY[532,13]. DBMS_UTILITY.DB_VERSION is deprecated!
PLW-06021 PRAGMA DEPRECATE on string is misplaced
The pragma deprecate should follow immediately after the declaration of the entity that is being deprecated. Place the pragma immediately after the declaration of the entity that is being deprecated.
SQL> CREATE OR REPLACE PROCEDURE plw06021 AUTHID DEFINER IS
  2  PRAGMA DEPRECATE(pragma_dep);
  3  BEGIN
  4    DBMS_OUTPUT.PUT_LINE('PLW06021');
  5  END plw06021;
  6  /

SP2-0804: Procedure created with compilation warnings

SQL> sho err
Errors for PACKAGE PLW06019B:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/8 PLW-06021: PRAGMA DEPRECATE on PRAGMA_DEP is misplaced
PLW-06022 Cannot use PRAGMA DEPRECATE on this entity
This entity cannot be deprecated. Deprecation only applies to entities that may be declared in a package or type specification as well as to top-level procedure and function definitions.
SQL> CREATE OR REPLACE PROCEDURE plw06022 AUTHID DEFINER IS
  2  PROCEDURE nested_bar IS
  3  BEGIN
  4    dbms_output.put_line('Executing nested_bar');
  5  END nested_bar;
  6  PROCEDURE nested_foo IS
 10   PRAGMA DEPRECATE(NESTED_FOO , 'procedure nested_foo is deprecated');
 11  BEGIN
 12     dbms_output.put_line('Executing nested_foo');
 13  END nested_foo;
 14  BEGIN
 15    dbms_output.put_line('Executing foo');
 16    nested_bar;
 17  END plw-6022;
 18  /

SP2-0804: Procedure created with compilation warnings

SQL> sho err
Errors for PROCEDURE FOO:

LINE/COL ERROR
-------- ---------------------------------------------------
 8/4 PLW-06006: uncalled procedure "NESTED_FOO" is removed.
10/4 PLW-06022: cannot use PRAGMA DEPRECATE on this entity
PLW-06023 Invocation of string computes trivial value
An IS NULL, IS NOT NULL or NVL operator was used on an object that is either never null or always null. The code may be made more efficient by eliding the call. Rewrite the code to remove the call.
TBD
PLW-06024 Incorrect use of PRAGMA COVERAGE
PRAGMA COVERAGE was encountered in a location in which it did not belong. Rewrite the code so that occurrences of NOT_FEASIBLE_START match occurrences of NOT_FEASIBLE_END. Pragmas may not be nested.
TBD
PLW-06025 Implicit use of NLS session parameters may be a security risk
A conversion to a CHAR or VARCHAR type without the explicit specification of National Language Support (NLS) conversion parameters may introduce security risks. This may occur during implicit conversion, as when non-character types are concatenated. Rewrite implicit conversions to explicitly specify the format model to use in the conversion.
TBD
PLW-06026 Package specification exposes global variable
A global variable was directly declared in a package specification. Rewrite the code to avoid exposing a global variable directly in the package specification, for example, by moving the global variable to the package body and providing a function to access and return its value.
SQL> CREATE OR REPLACE PACKAGE plw06026package AUTHID DEFINER AS
  2    globalVar NUMBER := 1;
  3  END plw06026;
  4  /

SP2-0808: Package created with compilation warnings

SQL> sho err
Errors for PACKAGE PLW06026:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/7 PLW-06026: package specification exposes global variable
PLW-06027 Procedure "string" is removed after inlining
After inlining, static program analysis determined that all calls to a procedure were inlined or removed. Therefore, it was removed to save time during compilation and save space during execution.

Action: Inspect the program logic for possible defects. Disable the warning if the procedure is useful and inlining of all calls is expected.
TBD
PLW-06028 Incorrect argument to COVERAGE pragma
COVERAGE pragma was supplied an illegal argument.

Action: Supply a valid string argument to the pragma which includes 'NOT_FEASIBLE', 'NOT_FEASIBLE_START', or 'NOT_FEASIBLE_END'.
TBD
PLW-06029 PRAGMA SUPPRESSES_WARNING_6009 on string is misplaced
Misplaced pragma. The pragma SUPPRESSES_WARNING_6009 should follow immediately after the declaration or the definition of the entity specified as argument.

Action: Place the pragma immediately after the declaration or the definition of the entity that is specified as an argument.
TBD
 
Performance Warning Messages (7000-7249)
PLW-07203 Parameter 'string' may benefit from use of the NOCOPY compiler hint
The mode of the specified parameter was IN OUT or OUT. Use of the NOCOPY compiler hint may speed up calls to this subprogram.
ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

CREATE OR REPLACE PROCEDURE plw07203(sa IN OUT dbms_sql.varchar2a) IS
BEGIN
  dbms_output.put_line('This is a test');
END plw07203;
/

CREATE OR REPLACE PROCEDURE plw07203(sa IN OUT NOCOPY dbms_sql.varchar2a) IS
BEGIN
  dbms_output.put_line('This is a test');
END plw07203;
/

sho err
PLW-07204 Conversion away from column type may result in sub-optimal query plan.
The column type and the bind type do not exactly match. This may result in the column being converted to the type of the bind variable. This type conversion may prevent the SQL optimizer from using any index the column participates in. This may adversely affect the execution performance of this statement.
desc servers

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

CREATE OR REPLACE PROCEDURE plw07204 IS
 v VARCHAR2(10);
 i VARCHAR2(10);
BEGIN
  SELECT srvr_id
  INTO v
  FROM servers
  WHERE rownum = 1;

  SELECT COUNT(*)
  INTO i
  FROM servers
  WHERE srvr_id = v;
END plw07204;
/

sho err
PLW-07205 SIMPLE_INTEGER is mixed with BINARY_INTEGER or PLS_INTEGER
Using SIMPLE_INTEGER and BINARY_INTEGER or PLS_INTEGER arguments in the same arithmetic expression may inhibit certain optimizations.
ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

CREATE OR REPLACE PROCEDURE plw07205 IS
 si SIMPLE_INTEGER := 1;
 ri PLS_INTEGER := 1;
 n  NUMBER;
BEGIN
  n := si + ri;
END plw07205;
/

sho err
PLW-07206 Analysis suggests that the assignment to 'string' may be unnecessary
This assignment may be unnecessary; the PL/SQL optimizer could not find any further use of the variable which was being set. If the assignment was being done for some side-effect such as raising a specific exception, the compiler may not have been able to understand the side-effect and this warning may be inappropriate.
ALTER SESSION SET PLSQL_WARNINGS='DISABLE:ALL';

CREATE OR REPLACE PACKAGE plw07206 IS
 PROCEDURE p(param VARCHAR2);
END plw07206;
/

CREATE OR REPLACE PACKAGE BODY plw07206 IS
 PROCEDURE p(param VARCHAR2) IS
 x VARCHAR2(10);
 BEGIN
   x := param;
 END p;
END plw07206;
/

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

CREATE OR REPLACE PACKAGE BODY plw07206 IS
 PROCEDURE p(param VARCHAR2) IS
 x VARCHAR2(10);
 BEGIN
   x := param;
 END p;
END plw07206;
/

sho err
PLW-07207 BULK COLLECT used without the LIMIT clause
The BULK COLLECT FETCH did not have a LIMIT clause potentially producing in a memory shortage at run time.
-- this compilation is successful due to the presence of the limit clause
CREATE OR REPLACE PROCEDURE plw07207 AUTHID DEFINER IS
 CURSOR a_cur IS
 SELECT program_id
 FROM airplanes;

 TYPE myarray IS TABLE OF a_cur%ROWTYPE;
 cur_array myarray;
BEGIN
  OPEN a_cur;
  LOOP
    FETCH a_cur BULK COLLECT INTO cur_array LIMIT 100;
    EXIT WHEN a_cur%NOTFOUND;
  END LOOP;
  CLOSE a_cur;
END plw07207;
/


-- this compilation, without the limit clause, generates a warning
CREATE OR REPLACE PROCEDURE plw07207 AUTHID DEFINER IS
 CURSOR a_cur IS
 SELECT program_id
 FROM airplanes;

 TYPE myarray IS TABLE OF a_cur%ROWTYPE;
 cur_array myarray;
BEGIN
  OPEN a_cur;
  LOOP
    FETCH a_cur BULK COLLECT INTO cur_array;
    EXIT WHEN a_cur%NOTFOUND;
  END LOOP;
  CLOSE a_cur;
END plw07207;
/

sho err

Related Topics
Database Security
PL/SQL Warnings
DBMS_WARNING
DBMS_WARNING_INTERNAL
Errors
Exception Handling
PL/SQL Object Settings
PRAGMA SUPPRESSES_WARNING_6009
Procedures
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