Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> help about ora_sql_txt(sql_text)
How to get the sql text when a user executes a dml statment? I wrote a trigger like this:(a triiger on the table 'T' of schema 'TEST')
CREATE OR REPLACE TRIGGER test
AFTER insert ON test.t
declare
sql_text ora_name_list_t;
state_sql dml_trace.ddl_sql%TYPE;
BEGIN
FOR i IN 1..ora_sql_txt(sql_text) LOOP state_sql := state_sql||sql_text(i); INSERT INTO t VALUES (i);
INSERT INTO dml_trace(user_name,ipaddress,audit_time,schema_user,schema_object,ddl_sql) VALUES(sys_context('userenv','session_user'),sys_context('userenv','ip_address'),SYSDATE, ora_dict_obj_owner,ora_dict_obj_name,state_sql);EXCEPTION
but when a user executes a insert on test.t,there is a exception,and through a dbms_output.put_line('ora_sql_txt(sql_text)is'||ora_sql_txt(sql_text)) I found the value of ora_sql_txt(sql_text) is null,then how can I get a dml text?
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Aug 01 2006 - 10:01:36 CDT
![]() |
![]() |