MySQL Forums
Forum List  »  Triggers

Re: create trigger statement
Posted by: davy timmermans
Date: June 11, 2006 12:27PM

one trigger with 3 statements (insert, delete , update) inside the trigger
important to know: this statements are performed on a SHADOWTABLE.

the delete trigger should check for each device from table DEVICE if it has a record in the SHADOWTABLE on deleting from table A

4 possibilities when checking SHADOWTABLE :

no entry
entry with action 'U','I' ,'D' specified


pseudo code

AFTER DELETE on A

//it should check for each device wich statement to perform!!!::

foreach DEVICE ID from DEVICE {

INSERT INTO SHADOWTABLE ///this means that there was no entry for old.A
VALUES (old.A, DEVICE ID, ‘D’)
WHERE action != ‘I’ or ’U’ ; //

ELSE

DELETE FROM SHADOWTABLE
WHERE action= ‘I’ ;

ELSE

UPDATE SHADOWTABLE
SET action=‘D’ where action=’U’

}

clear?? otherwise ask me ;) now I'm busy with examinations;)

Options: ReplyQuote


Subject
Views
Written By
Posted
4428
June 03, 2006 08:37AM
2101
June 09, 2006 05:29PM
2137
June 09, 2006 09:27PM
Re: create trigger statement
2057
June 11, 2006 12:27PM
2280
June 11, 2006 10:06PM
2018
June 13, 2006 12:04AM
2134
June 13, 2006 12:05AM
2115
June 13, 2006 06:53AM
2031
June 13, 2006 08:24AM
2141
June 13, 2006 09:16AM
2256
June 13, 2006 03:42PM
2165
June 13, 2006 07:45PM
2542
June 14, 2006 12:25AM


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.