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 -> trigger statement:

trigger statement:

From: <spliffmonkey_at_iname.com>
Date: 10 Dec 2005 11:30:13 -0800
Message-ID: <1134243013.480836.76240@g44g2000cwa.googlegroups.com>


Quick question. This trigger works fine (it just sets a themepark rides status as closed when an accident has been inserted into the accident table):

CREATE TRIGGER closeride
AFTER INSERT ON Accident
REFERENCING NEW AS newRow
 FOR EACH ROW
BEGIN
update Ride set Ride.status = 'closed' where Ride.Ridename =
:newRow.Ridename;

END closeride;

Now I want to make a variation on this where if the accident table returns more than 3 rows for a given ride then the ride status is set to closed. This is my attempt (bellow). Could someone take a look at it? Its the same as the one above except for the WHEN

CREATE TRIGGER toomanyaccidents
AFTER INSERT ON Accident
 REFERENCING NEW AS newRow
FOR EACH ROW
WHEN((select * from accident where Ridename = :new.Ridename)> 2) BEGIN
update Ride set Ride.status = 'closed' where Ride.Ridename =
:newRow.Ridename;

END closeride; Received on Sat Dec 10 2005 - 13:30:13 CST

Original text of this message

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