Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Get the sql query in oracle trigger

Re: Get the sql query in oracle trigger

From: William Robertson <william.robertson_at_bigfoot.com>
Date: 30 Mar 2006 00:31:30 -0800
Message-ID: <1143707490.432567.115620@e56g2000cwe.googlegroups.com>


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;
END;
/ Received on Thu Mar 30 2006 - 02:31:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US