Oracle GET_ERROR$
Version 12.1.0.1

General Information
Library Note Morgan's Library Page Footer
The Library is currently in the process of being upgraded from Oracle Database Version 11.2.0.3 to 12.1.0.1. Demos are being upgraded to reflect the new Container paradigm as well as EBR (Edition Based Redefinition) and may contain references to CDBs, PDBs, and other objects you may not be familiar with such as CDB_OBJECTS_AE: Welcome to 12c.
Purpose Find all the error messages. The following query returns the errors that caused the invalid classes (if any) from the previous query (in
the script which called initjvm4, either initjvm.sql or jvmursc.sql).
AUTHID DEFINER
Dependencies
DBMS_JAVA USER_ERRORS  
Documented No
First Available Not known
Package Header

Reformatted for readability
CREATE OR REPLACE PACKAGE get_error$ AS
 TYPE myrec IS RECORD (errormsg VARCHAR(4000));
 TYPE myrctype IS REF CURSOR RETURN myrec;

 FUNCTION error_lines(classname IN VARCHAR2) RETURN myrctype;
END get_error$;
/
Package Body

Reformatted for readability
CREATE OR REPLACE PACKAGE BODY get_error$ AS
 FUNCTION error_lines(classname IN VARCHAR2) RETURN myrctype IS
  rc         myrctype;
  short_name VARCHAR2(50);
  n          NUMBER;
 BEGIN
   OPEN rc FOR
   SELECT text
   FROM user_errors
   WHERE name = dbms_java.shortname(classname);

   RETURN rc;
 END;
END get_error$;
/
Security Model Owned by SYS with EXECUTE granted to PUBLIC
Source {ORACLE_HOME}/rdbms/admin/initjvm4.sql
 
ERROR_LINES
To get an output this demo requires rec_array have a size > 0.

See comment under "purpose" at the top of the page.
get_error$.error_lines(classname IN VARCHAR2) RETURN myrctype;
SQL> SELECT name, COUNT(*)
   2 FROM user_errors
   3 GROUP BY name
   4 ORDER BY 1;

NAME                           COUNT(*)
------------------------------ --------
DBMS_CLUSTDB                          3
DBMS_LIBCACHE                         5
DBMS_LIBCACHE$DEF                     1
DBMS_METADATA_HACK                    5
DBMS_XS_SECCLASS_EVENTS               2
DBMS_XS_WEAK_AUTH                     9
PLW05008                              1
PLW05019                              1
PLW05020                              3
SYS_PLSQL_F7B6403D_9_1                1
USER_LOCK                             6
UTL_MAIL                             11
UTL_MAIL_INTERNAL                     4
XS_OBJECT_MIGRATION                   6

set serveroutput on

DECLARE
 RetVal get_error$.myrcType;
 RetRec get_error$.myRec;
 x integer;

 TYPE array_t IS TABLE OF VARCHAR2(4000)INDEX BY BINARY_INTEGER;
 rec_array array_t;
BEGIN
  RetVal := get_error$.error_lines('LOGMNR_KRVRDLUID3');

  FETCH RetVal BULK COLLECT INTO rec_array;
  FOR i IN rec_array.FIRST .. rec_array.LAST LOOP
    dbms_output.put_line(rec_array(i));
  END LOOP;
EXCEPTION
  WHEN OTHERS THEN
    dbms_output.put_line(TO_CHAR(rec_array.COUNT));
END;
/
PLW-05018: unit LOGMNR_KRVRDLUID3 omitted optional AUTHID clause; default value DEFINER used
PLW-06010: keyword "NAME" used as a defined name
PLW-06009: procedure "LOGMNR_KRVRDLUID3" OTHERS handler does not end in RAISE or RAISE_APPLICATION_E
PLW-06009: procedure "EDIT_A_LOGMNR_TABLE" OTHERS handler does not end in RAISE or RAISE_APPLICATION
PLW-06009: procedure "CREATE_TRANSIENT_TABLES" OTHERS handler does not end in RAISE or RAISE_APPLICA
PLW-06009: procedure "DROP_TRANSIENT_TABLES" OTHERS handler does not end in RAISE or RAISE_APPLICATI
PLW-06009: procedure "DROP_TRANSIENT_TABLES" OTHERS handler does not end in RAISE or RAISE_APPLICATI
PLW-06009: procedure "CLEAN_TRANSIENTS" OTHERS handler does not end in RAISE or RAISE_APPLICATION_ER
PLW-06009: procedure "CLEAN_TRANSIENTS" OTHERS handler does not end in RAISE or RAISE_APPLICATION_ER
PLW-06009: procedure "PREPARE_LOAD_LOGMNR_DICTTABS" OTHERS handler does not end in RAISE or RAISE_AP
PLW-06009: procedure "RUN_LOAD_LOGMNR_DICTTABS" OTHERS handler does not end in RAISE or RAISE_APPLIC
PLW-06009: procedure "GETLUID" OTHERS handler does not end in RAISE or RAISE_APPLICATION_ERROR
PLW-07206: analysis suggests that the assignment to 'CUR' may be unnecessary
PLW-07206: analysis suggests that the assignment to 'CUR1' may be unnecessary
PLW-06002: Unreachable code
PLW-06002: Unreachable code
PLW-06002: Unreachable code

Related Topics
DBMS_ERRLOG
Exception Handling
Packages

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-2014 Daniel A. Morgan All Rights Reserved