Hi Guys, I was wondering if someone could help me

 

I'm trying to create an AFTER SERVERERROR trigger that will log all errors and the SQL that caused the error.

 

Here's what I have so far

 

CREATE OR REPLACE TRIGGER server_error_trig

  AFTER SERVERERROR ON DATABASE

  DECLARE text varchar2(1000);

  BEGIN

  select sql_text into text

      from v$session a , v$sql b

      where a.audsid = sys_context('USERENV','SESSIONID')

      and a.prev_sql_addr = b.address;

    INSERT INTO server_error_log VALUES(ora_sysevent, ora_login_user, SYS_CONTEXT('USERENV','OS_USER'), SYS_CONTEXT('USERENV','CLIENT_INFO'), sysdate, ora_server_error(1), dbms_utility.format_error_stack, text);

  END;

 

my problem seems to be if I select * from v$session I can see my prev_sql_addr.

BUT

If I do this

select prev_sql_addr from v$session where AUDSID = sys_context('USERENV','SESSIONID');

it returns 00

 

could someone try the sql above and tell me if works for you.

I'm running 8.1.7.3

 

Reply via email to