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: create assertion?

Re: create assertion?

From: eugene kim <eugene1977_at_hotmail.com>
Date: Sun, 08 Sep 2002 01:59:37 +0000
Message-ID: <aldhi1$v6$1@newsreader.mailgate.org>

thank you..
so, assertion doesn't not exist in oracle.. heh ..

about triggers,
if user insert a row into orders table,
i want a trigger to set duedate attribute of that row to sysdate+10

create trigger s_duedate after insert on orders begin

        update orders set duedate = sysdate+10; end s_duedate;
/

as you pointed out, it will update all the rows in column..

i looked at application developer's guide. i tried
using for each row + :old (:old represents the table before insertion? in my case?... it's just not clear, i spent good deal of time figuring out 'each row' just indicates trigger get fired for each affected row, (so i don't have any info about the specific row inside for each statement) referencing new row as newr ..

create trigger s_duedate after insert on orders for each row
begin

        update orders set duedate = sysdate+10
        where :old.order_id = order_id;

end s_duedate;
/

ERROR at line 1:
ORA-04091: table CSI4335.ORDERS is mutating, trigger/function may not see it
ORA-06512: at "CSI4335.S_DUEDATE", line 2
ORA-04088: error during execution of trigger 'CSI4335.S_DUEDATE'

too vague.........
thanks.. Received on Sat Sep 07 2002 - 20:59:37 CDT

Original text of this message

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