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: Trigger

Re: Trigger

From: Stefan Poschenrieder <stefanp_at_raysono.com>
Date: Mon, 12 Nov 2001 10:39:14 +0100
Message-ID: <3BEF98C2.D484C3D7@raysono.com>


Thanks,

but this is not the solution, sure I tried BEFORE update, but this doesnt work. the same error-code

Alexei VORONOV wrote:

> You can try to replace your trigger by trigger "before insert or update". In
> this case your table will be read before your record come, but you need to
> remake calculations to be sure that the old value of "sum" + your new value
> is not more than 100.
>
> "Stefan Poschenrieder" <stefanp_at_raysono.com> a écrit dans le message news:
> 3BEC0DB1.8F795A01_at_raysono.com...
> > Hi,
> >
> > I'd like to make a trigger on a table which shall check, on any update
> > and insert
> > if the sum of all values of a specific column is below 100
> > i did it like this:
> >
> > but if i do an update i get the error "trigger is not allowed to see the
> > data because it the data is
> > just being modified" .. can i solve this problem with a "trigger" ? the
> > trigger has to read the same data
> > in the table, but is not allowed to do so... any idea ?
> >
> >
> > declare
> > var_gewichtung number;
> > begin
> >
> > select nvl(sum(GEWICHTUNG),0) into var_gewichtung from
> > PORTFOLIOZUSAMMENSETZUNG
> > WHERE ID_PORTFOLIO = :new.id_portfolio;
> >
> >
> > if var_gewichtung + :new.gewichtung > 100 then
> > var_gewichtung := 100 - var_gewichtung;
> > raise_application_error(-20000, 'Die Summe aller Gewichtungen zu
> > diesem Portfolio ist größer als 100. Bitte geben Sie einen Wert <= ' ||
> > var_gewichtung || ' ein.');
> > end if;
> >
> >
> > end;
> >
Received on Mon Nov 12 2001 - 03:39:14 CST

Original text of this message

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