Oracle PL/SQL Tutorial/SQL PLUS Session Environment/plsql warnings — различия между версиями

Материал из SQL эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 13:45, 26 мая 2010

ALTER SESSION SET plsql_warnings = "disable:all"

SQL>
SQL> CREATE OR REPLACE PROCEDURE plw5001
  2  IS
  3     a   BOOLEAN;
  4     a   PLS_INTEGER;
  5  BEGIN
  6     a := 1;
  7     DBMS_OUTPUT.put_line ("Will not compile?");
  8  END plw5001;
  9  /
Warning: Procedure created with compilation errors.
SQL>
SQL> SHOW ERRORS
Errors for PROCEDURE PLW5001:
LINE/COL ERROR
-------- -----------------------------------------------------------------
4/4      PLW-05001: previous use of "A" (at line 3) conflicts with this
         use
6/4      PL/SQL: Statement ignored
6/4      PLS-00371: at most one declaration for "A" is permitted
SQL>
SQL> ALTER SESSION SET plsql_warnings = "disable:all"
  2  /
Session altered.
SQL>
SQL> CREATE OR REPLACE PROCEDURE plw5001
  2  IS
  3     a   BOOLEAN;
  4     a   PLS_INTEGER;
  5  BEGIN
  6     DBMS_OUTPUT.put_line ("Will not compile?");
  7  END plw5001;
  8  /
Procedure created.
SQL>
SQL> ALTER PROCEDURE plw5001 COMPILE plsql_warnings = "enable:all"
  2  /
SP2-0805: Procedure altered with compilation warnings
SQL>
SQL> SHOW ERRORS
Errors for PROCEDURE PLW5001:
LINE/COL ERROR
-------- -----------------------------------------------------------------
4/4      PLW-05001: previous use of "A" (at line 3) conflicts with this
         use
SQL>
SQL>


ALTER SESSION SET PLSQL_WARNINGS = "ENABLE:ALL"

SQL>
SQL>
SQL>
SQL> ALTER SESSION SET PLSQL_WARNINGS = "ENABLE:ALL"
  2  /
Session altered.
SQL> CREATE OR REPLACE PACKAGE plw5000
  2  IS
  3     TYPE collection_t IS TABLE OF VARCHAR2 (100);
  4
  5     PROCEDURE proc (collection_in IN OUT NOCOPY collection_t);
  6  END plw5000;
  7  /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY plw5000
  2  IS
  3     PROCEDURE proc (collection_in IN OUT collection_t)
  4     IS
  5     BEGIN
  6        DBMS_OUTPUT.PUT_LINE ("Hello!");
  7     END proc;
  8  END plw5000;
  9  /
SP2-0810: Package Body created with compilation warnings
SQL>
SQL> SHOW ERRORS PACKAGE BODY plw5000
Errors for PACKAGE BODY PLW5000:
LINE/COL ERROR
-------- -----------------------------------------------------------------
3/20     PLW-05000: mismatch in NOCOPY qualification between specification
         and body
3/20     PLW-07203: parameter "COLLECTION_IN" may benefit from use of the
         NOCOPY compiler hint
SQL>