Re: After Insert/Update trigger question

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 2000/02/17
Message-ID: <apvnaskhfpfuoku64t2ko6qn2p9a9seovc_at_4ax.com>#1/1


A copy of this was sent to "Ken Halsted" <kenman_at_mail.snider.net> (if that email address didn't require changing) On Wed, 16 Feb 2000 15:58:24 -0600, you wrote:

>I have this trigger on table: AR_CUSTOMERS:
>
>--------------------------
>CREATE OR REPLACE TRIGGER T_CUSTOMERS_AIUR AFTER INSERT OR UPDATE
>ON AR_CUSTOMERS
>FOR EACH ROW
>BEGIN
> UPDATE_CEDR_CUSTS(:NEW.CUSTOMER_NUMBER);
>END;
>------------------------
>
>UPDATE_CEDR_CUSTS simply reads the SAME table based on the customer number
>and updates another table in our database with some of the info.
>
>I keep getting an error when I update or insert a record from the form based
>on AR_CUSTOMERS but if I run the procedure stand-alone, it works fine. Any
>suggestions?
>
>Thanks for any help,
>
>Ken.
>
>

You don't mention the error but its probably a mutating table right?

If update_cedr_custs reads exactly the one row from ar_customers that was modified -- the best solution is to PASS the :new.columns into update_cedr_custs from the trigger instead of having it read the table (best cause it'll work AND its faster).

If update_cedr_custs reads more then just the modified record -- see http://osi.oracle.com/~tkyte/Mutate/index.html for how to do this.

-- 
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
 
Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation
Received on Thu Feb 17 2000 - 00:00:00 CET

Original text of this message