SunQuest
           Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old May 8th, 2004, 10:01 PM
macuser55 macuser55 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 19 macuser55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Red face Simple Triggers

Hello all,

I was wanting to implement a trigger that implemented an action after an update on a table.

Currently I have this:

CREATE TRIGGER oTrigger AFTER UPDATE ON orders
WHEN (paymentStatus NOT null
AND deliveryStatus NOT NULL)
FOR EACH ROW BEGIN
INSERT INTO storedAt VALUES (new.PID, new.WID, new.Number)
END

I get the following error:

"WHEN clause cannot be used with table level triggers"

Bascially I want to perform the trigger action on the updated tuple only (only one will be updated per update statement). What is my problem here, and how should I go about this?

Thanks for your help

Chris

Reply With Quote
  #2  
Old May 9th, 2004, 03:14 AM
shammat shammat is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 972 shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 49 m 10 sec
Reputation Power: 57
Something like:
Code:
CREATE TRIGGER oTrigger AFTER UPDATE ON orders
FOR EACH ROW 
BEGIN
  if (new.paymentStatus is NOT NULL AND new.deliveryStatus IS NOT NULL)
    INSERT INTO storedAt VALUES (new.PID, new.WID, new.Number)
  END IF;
END

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Simple Triggers


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway