MySQL Forums
Forum List  »  Triggers

AFTER INSERT DELETE ROW ?
Posted by: Keith Blackwell
Date: November 16, 2005 11:43AM

Hi
I've got an AFTER INSERT trigger that works good. But, I want it to delete the row after it's been inserted and after the main body of the trigger completes.
The table contains an auto-number field, "id"
So, basically I want to do this...
AFTER INSERT ON TABLE_X
FOR EACH ROW
BEGIN
IF TABLE_Y CONTAINS RECORD WHERE Y.1 = X.1 THEN
UPDATE TABLE_Y, SET Y.2=X.2, Y.3=X.3, ETC
ELSE
UPDATE TABLE_Y, SET Y.4=X.4, Y.5=X.5, ETC
END IF
DELETE FROM TABLE_X WHERE id=NEW.id
END

The DELETE FROM <table that got acted(inserted) upon by trigger> part isn't working.
What am I doing wrong here?
Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
AFTER INSERT DELETE ROW ?
18022
November 16, 2005 11:43AM
5686
November 16, 2005 12:30PM
4113
March 01, 2006 03:47AM
3598
March 01, 2006 07:49AM
4365
November 16, 2005 10:46PM
10116
November 17, 2005 07:04AM
4592
November 17, 2005 12:29PM
4557
November 17, 2005 02:44PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.