MySQL Forums
Forum List  »  Triggers

Re: Confused on Triggers and Store Procedures
Posted by: Peter Brawley
Date: January 02, 2016 12:19AM

To get the last auto_increment value used, call last_insert_id().

You can't call UPDATE on `pen` in a Trigger on pen.

And isn't there a typo: aren't you trying to set location_id? So ...

set new.location_id = last_insert_id();

Options: ReplyQuote

Written By
Re: Confused on Triggers and Store Procedures
January 02, 2016 12:19AM

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.