Re: PL/SQL code help

From: Brian Price <bprice2000_at_sprintmail.com>
Date: 1998/03/06
Message-ID: <6dpbrb$6j$1_at_newsfep4.sprintmail.com>#1/1


First, the clause

    REFERENCING OLD AS ap.ap_invoices NEW AS oraap.ap_invoice_audit should be changed to

   REFERENCING OLD AS OLD NEW AS NEW Secondly, the reference to SYDATE probably should be SYSDATE.

Thirdly, move the "select osuser..." statement out of the insert and select the osuser into a pl/sql variable and then reference this variable in the insert statement.

Best of luck

Brian

>
>CREATE TRIGGER oraap.ap_invoice_ad
> AFTER DELETE ON ap.ap_invoices
> FOR EACH ROW
> REFERENCING OLD AS ap.ap_invoices
> NEW AS oraap.ap_invoice_audit
> FOR EACH ROW
> BEGIN
> INSERT INTO oraap.ap_invoice_audit
>
>(invoice_id,invoice_num,vendor_id,attribute1,delete_date,user_id)
> VALUES
>(old:invoice_id,old:invoice_num,old:vendor_id,old:attribute1,SYDATE
>(select osuser from V$session where audsid=userenv('sessionid')))
> END;
>
Received on Fri Mar 06 1998 - 00:00:00 CET

Original text of this message