MySQL Forums
Forum List  »  Triggers

Re: assign default values in trigger - solved
Posted by: jakub
Date: October 15, 2006 01:50PM

first - thank you for your advice - my solution:

//edited
	DECLARE newid MEDIUMINT(5);
	

	IF NEW.`timestamp` IS NULL OR NEW.`timestamp`='0000-00-00 00:00:00' OR NEW.`timestamp`='' THEN
		SET NEW.`timestamp` = NOW();
	END IF;

	IF NEW.`id` IS NULL OR NEW.`id`='' THEN
		CALL getNewStructureId(newid);
		SET NEW.`id` = newid; 
	END IF;



Edited 1 time(s). Last edit at 10/15/2006 01:51PM by jakub .

Options: ReplyQuote


Subject
Views
Written By
Posted
5690
October 15, 2006 09:15AM
2383
October 15, 2006 10:52AM
2058
October 15, 2006 11:05AM
1865
October 15, 2006 11:37AM
Re: assign default values in trigger - solved
2033
October 15, 2006 01:50PM


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.