MySQL Forums
Forum List  »  Triggers

Re: Cannot get trigger to run correctly
Posted by: Peter Brawley
Date: June 19, 2011 07:51PM

The Trigger code has errors. Try ...

DELIMITER //
CREATE TRIGGER defaultinvoiceDate BEFORE INSERT ON invoiceheader FOR EACH ROW 
BEGIN
  SET new.invoicedate = now();
END;
//
DELIMITER ;

or simply ...

CREATE TRIGGER defaultinvoiceDate BEFORE INSERT ON invoiceheader
FOR EACH ROW SET new.invoicedate = now();

or even more simply, why not make the column TIMESTAMP DEFAULT NOW()?

PB

Options: Reply• Quote


Subject
Views
Written By
Posted
Re: Cannot get trigger to run correctly
1264
June 19, 2011 07:51PM


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.