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

Re: trigger statement:

From: DA Morgan <damorgan_at_psoug.org>
Date: Sat, 10 Dec 2005 12:50:42 -0800
Message-ID: <1134247839.810903@jetspin.drizzle.com>


spliffmonkey_at_iname.com wrote:
> 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;

  1. SELECT COUNT(*)
  2. IF statement
  3. Do whatever -- Daniel A. Morgan http://www.psoug.org damorgan_at_x.washington.edu (replace x with u to respond)
Received on Sat Dec 10 2005 - 14:50:42 CST

Original text of this message

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