Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Trigger
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 Fri Nov 09 2001 - 11:09:05 CST
![]() |
![]() |