In Oracle 11g, error messages in the SQLPLUS can be recorded to a table automatically when ERRORLOGGING option is turned on.
By default, this feature is off, you can enable this feature just by typing "SET ERRORLOGGING ON" in SQLPLUS and a table called sperrorlog will be created in the current schema. Then all subsequent errors generating from SQL or PL/SQL statements will be written to sperrorlog.


Here is an example

SQL> set errorloggin on
SQL> desc sperrorlog
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 USERNAME                                           VARCHAR2(256)
 TIMESTAMP                                          TIMESTAMP(6)
 SCRIPT                                             VARCHAR2(1024)
 IDENTIFIER                                         VARCHAR2(256)
 MESSAGE                                            CLOB
 STATEMENT                                          CLOB

SQL> select * from aaa;
select * from aaa
              *
ERROR at line 1:
ORA-00942: table or view does not exist


SQL> select timestamp, username,statement, message  from sperrorlog;

TIMESTAMP
---------------------------------------------------------------------------
USERNAME
--------------------------------------------------------------------------------
STATEMENT
--------------------------------------------------------------------------------
MESSAGE
--------------------------------------------------------------------------------
22-MAR-11 04.47.11.000000 PM
SYS
select * from aaa
ORA-00942: table or view does not exist

Find more from Oracle documents:
http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch12040.htm#SQPUG160

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati