Get detailed error message from user_errors : USER_ERRORS « System Tables Views « Oracle PL / SQL






Get detailed error message from user_errors

    
SQL> 
SQL> CREATE OR REPLACE PROCEDURE Simple AS
  2    v_Counter NUMBER;
  3  BEGIN
  4    v_Counter := 7;
  5  END Simple;
  6  /

Procedure created.

SQL>
SQL> COLUMN object_name format a20
SQL> COLUMN line format 9999
SQL> COLUMN position format 99999
SQL> COLUMN text format a59
SQL>
SQL> SELECT object_name, object_type, status
  2    FROM user_objects
  3    WHERE object_name = 'SIMPLE';

OBJECT_NAME          OBJECT_TYPE         STATUS
-------------------- ------------------- ----------
SIMPLE               PROCEDURE           VALID

1 row selected.

SQL>
SQL> SELECT text FROM user_source WHERE name = 'SIMPLE' ORDER BY line;

TEXT
-----------------------------------------------------------
PROCEDURE Simple AS
  v_Counter NUMBER;
BEGIN
  v_Counter := 7;
END Simple;

5 rows selected.

SQL>
SQL> SELECT line, position, text FROM user_errors WHERE name = 'SIMPLE' ORDER BY sequence;

no rows selected

SQL>
SQL> CREATE OR REPLACE PROCEDURE Simple AS
  2    v_Counter NUMBER;
  3  BEGIN
  4    v_Counter := 7
  5  END Simple;
  6  /

Warning: Procedure created with compilation errors.

SQL>
SQL>
SQL> SELECT line, position, text FROM user_errors WHERE name = 'SIMPLE' ORDER BY sequence;

 LINE POSITION TEXT
----- -------- -----------------------------------------------------------
    5        1 PLS-00103: Encountered the symbol "END" when expecting one
               of the following:

                  * & = - + ; < / > at in is mod remainder not rem
                  <an exponent (**)> <> or != or ~= >= <= <> and or like L
               IKE2_
                  LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
               The symbol ";" was substituted for "END" to continue.


1 row selected.

SQL>

   
    
    
    
  








Related examples in the same category

1.Viewing errors in the database
2.Data dictionary views for valid and invalid