Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Get the sql query in oracle trigger
eric.h.lin_at_gmail.com wrote:
> so anyone know how to get the sql query inside the trigger? so i can
> pass it to other store procedure / java sp~
Perhaps something like this:
CREATE OR REPLACE TRIGGER testit_trg
BEFORE INSERT OR UPDATE ON testit FOR EACH ROW
DECLARE
v_sql_text ORA_NAME_LIST_T;
v_stmt CLOB;
n PLS_INTEGER := ORA_SQL_TXT(v_sql_text);
BEGIN
FOR i IN 1..n LOOP
DBMS_OUTPUT.PUT_LINE(v_sql_text(i)); v_stmt := v_stmt || v_sql_text(i);END LOOP;