MySQL Forums
Forum List  »  Triggers

Re: LAST_INSERT_ID(expr) inside trigger
Posted by: Bob Field
Date: February 24, 2006 03:38PM

I have to concur with your problem statement. I tried testing your scenario and some variations to it to no avail. I even set up an 'after insert' trigger to stuff the new id1 value into last_insert_id() and that didn't work either. I tried making the column into a real auto_increment column, adding 'OR new.id1 = 0' to the test of whether to calculate a new id1. Id1 got properly calculated but still last_insert_id() did not return a value. It's like what happens inside the trigger stays inside the trigger. You can execute an insert inside a trigger and return an id, but any attempts to get a value to persist to outside the trigger just don't seem to be working.

Options: ReplyQuote


Subject
Views
Written By
Posted
14343
February 24, 2006 02:40PM
Re: LAST_INSERT_ID(expr) inside trigger
5405
February 24, 2006 03:38PM


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.