Re: ORACLE update trigger

From: DA Morgan <damorgan_at_psoug.org>
Date: Wed, 20 Sep 2006 07:45:28 -0700
Message-ID: <1158763526.855929_at_bubbleator.drizzle.com>


Chris wrote:
> Hi,
>
> I am relatively new to databsae triggers and I am currently having a
> problem with an UPDATE AFTER trigger. I am using Forms 6i to perform a
> few calculations and then commit then to the database. When these
> records have been updated in the database (AFTER UPDATE) i want to
> create a trigger that will perform further calculations.
>
> The code I have which is causing me a few problems is:
>
> CREATE OR REPLACE TRIGGER update_rech_figures
> AFTER UPDATE ON uws_rech_cash
> BEGIN
> IF non_exception_total_award IS NOT NULL AND
> exception_total_award IS NOT NULL THEN
> summ_total_award := NVL(non_exception_total_award,0)
> +NVL(exception_total_award,0);
> END IF;
> END;
>
> The non_exception_total_award & exception_total_award are the figures
> that are returned from the form. I want the trigger to add them
> together when they have been updated to the uws_rech_cash table.
>
> Thanks in advance
> Chris

Is it your intention to have a STATEMENT LEVEL rather than a ROW LEVEL trigger?

What is it you are asking? For someone to write your trigger for you? The code you have above is totally non-functional. You have undeclared variables that you don't use for any purpose and it is not at all apparent what you think the value of summ_total_award is supposed to do. It seems you need to understand, too, :NEW and :OLD.

Go to Morgan's library at www.psoug.org and look up TABLE TRIGGERS. Especially those using :NEW and :OLD, those with DECLARE sections and read the docs on triggers at http://tahiti.oracle.com to understand the difference between STATEMENT and ROW LEVEL triggers.

Then if you are still having problems repost and include you version number.

-- 
Daniel Morgan
University of Washington
Puget Sound Oracle Users Group
Received on Wed Sep 20 2006 - 16:45:28 CEST

Original text of this message