MySQL Forums
Forum List  »  Triggers

Variables within Trigger
Posted by: TJ Tamagni
Date: August 16, 2006 08:25AM

here is my code....

loop
fetch c into f_name, tpe, nll, ky, deflt, extra;
set new_name = NEW.f_name;
set old_name = OLD.f_name;
if new_name != old_name THEN
insert into x(`DateTimeUpdated`,`TableUpdated`,`FieldChanged`,`OldValue`,`NewValue`)
values(NOW(),'x',f_name,old_name,new_name);
END IF;
END LOOP;

so say f_name="ID" i need new_name to equal NEW.ID instead mysql is analyzing it as NEW.f_name and NEW.f_name doesn't exist.

Any suggestions?

Options: ReplyQuote


Subject
Views
Written By
Posted
Variables within Trigger
16090
August 16, 2006 08:25AM
7484
August 16, 2006 09:26AM
38900
August 21, 2006 06:35AM
8046
August 21, 2006 11:36AM


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.