MySQL Forums
Forum List  »  Newbie

Re: delete constraint with mySAM
Posted by: Roland Bouman
Date: August 11, 2005 07:17AM

You'd have to write a trigger (MySQL 5.0, but preferable 5.0.10) to do that. T1 would get a

on delete for each row

trigger:

create trigger adr_t1
after delete on T1
for each row
begin
update T2
set T1_ref = 0
where T1_ref = :old.id
;
end;

see http://dev.mysql.com/doc/mysql/en/create-trigger.html for more details

Options: ReplyQuote


Subject
Written By
Posted
Re: delete constraint with mySAM
August 11, 2005 07:17AM


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.