Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Using Database Trigger on Servererror to track all Oracle Errors
I've revised the trigger to properly capture the Oracle Error but I'd
really still like to be able to capture the actual offending SQL?
Does anyone have any ideas?
Users for this one application are reporting very sporadic ORA-00904 errors. I know what the error is but I'd really like to find the offending SQL statements.
create or replace trigger log_all_servererrors after servererror
on database
declare
v_output utl_file.file_type; v_sqlcode1 varchar2(250); v_sqlerrm varchar2(250);
v_sqlcode1:=server_error(1); v_sqlerrm :=SQLERRM; v_output := utl_file.fopen('C:\TEMP','log_all_servererrors.txt','a'); utl_file.put_line(v_output,'USER : '||user); utl_file.put_line(v_output,'DATE :
utl_file.put_line(v_output,'ERROR: '||v_sqlcode1); utl_file.new_line(v_output); utl_file.fclose (v_output);