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

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to write this Trigger ?

Re: How to write this Trigger ?

From: M. Armaghan Saqib <armaghan_at_yahoo.com>
Date: Tue, 14 Dec 1999 13:17:48 GMT
Message-ID: <835g1q$pj$1@nnrp1.deja.com>


Basically you can do this (and avoid mutating trigger error) from a STATEMENT trigger if you know which rows were affected during your SQL execution.

I have written a utility (SQL PlusPlus) which allows to generate a set of triggers and a package on a table to do almost anything like this. Download and use free.

regards,
M. Armaghan Saqib


QuestionExchange <USENET_at_questionexchange.com> wrote in message news:3015qx_at_questionexchange.com...
> Very simple - you can't. The rule is you can't read (select)
> from the table you have the trigger on.
> > I have a table t1.
> > Create table t1(
> > CostName Char(10),
> > Cost Number(12,2) default 0,
> > AllCost Number(12,2) default 0
> > );
> > I Want to use Trigger to set AllCost = sum(Cost) by CostName.
> > I use "after insert for each row" and get mutating error!
> >
> > How to write this trigger!
> > or some better ways to realise this function.
> >
> > eg:
> > Insert 'abc',1
> > the result 'abc',1,1
> > insert 'abc',2
> > the result 'abc',1,3
> > 'abc',2,3
> > insert 'abc',1
> > the result 'abc',1,4
> > 'abc',2,4
> > 'abc',1,4
> >
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
> >
>
> --
> This answer is courtesy of QuestionExchange.com
> http://www.questionexchange.com/showUsenetGuest.jhtml?
ans_id=8609&cus_id=USENET&qtn_id=7950

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Dec 14 1999 - 07:17:48 CST

Original text of this message

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