Oracle GET_ERROR$
Version 18.1.0.0

General Information
Library Note Morgan's Library Page Header
"I spent my entire adult life looking out for the well-being, the training, the equipping of the troops for whom I was responsible. I will not be lectured about what our military needs by a five-deferment draft dodger,"
~ Sen. Tammy Duckworth
Purpose Locates error messages.
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
What's New In 12cR2
What's New In 18cR1

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