Posts

Showing posts from September, 2013

TRIGGER TO GET SERVERERROR ON DATABASE

Lets create a trigger that will log all the errors in the database: It is better to create this trigger under SYS or DBA user's so that you don't have to grant all permission if you have to grant permissions separately. -------------------------------------------------------- --  DDL for Trigger AFTER_ERROR --------------------------------------------------------   CREATE OR REPLACE TRIGGER "AFTER_ERROR"     AFTER SERVERERROR ON DATABASE DECLARE     pragma autonomous_transaction;     id NUMBER;     sql_text ORA_NAME_LIST_T;     v_stmt CLOB;     n NUMBER; BEGIN     SELECT oraerror_seq.nextval INTO id FROM dual; --- Seq no's     --     n := ora_sql_txt(sql_text);     --     IF n >= 1     THEN         FOR i IN 1..n LOOP     ...