Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: mutating table error help
ouch.. this one is really hard to solve.. i've looked at many past examples in groups.google.com but it's just overwheleming..
.............
create or replace trigger game_after after insert or update of gamedate,
gamecity on games
for each row
declare val integer;
begin
select count(*) into val from games g
where (g.hometeamid = :new.visitorteamid or
g.hometeamid = :new.hometeamid or g.visitorteamid = :new.hometeamid or g.visitorteamid = :new.visitorteamid) and g.gamedate = :new.gamedate and g.gamecity <> :new.gamecity; if val > 0 then raise_application_error(-20000, 'No team may play two games in two different cities on the same day'); end if;