Have you tried the ora_sql_txt event ?

hth
connor

 --- david hill <[EMAIL PROTECTED]> wrote: > 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
> 
>  
> 
>  

=====
Connor McDonald
http://www.oracledba.co.uk
http://www.oaktable.net

"Some days you're the pigeon, some days you're the statue"

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: =?iso-8859-1?q?Connor=20McDonald?=
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to