MySQL Forums
Forum List  »  Stored Procedures

Re: LAST_INSERT_ID() question.
Posted by: Roland Bouman
Date: November 05, 2005 05:33PM

I'm a bit confused, because you say: "In an after *update* trigger I write..If I *insert* a new record into A".

Is this really the case (update trigger gets fired for insert event?)?

last_insert_id() returns the last id that was handed out to an auto_increment column within your session. So, if you'd have an after INSERT trigger, and INSERT from within your trigger, and then reference last_insert_id(), you'd get the value of the id of the record you inserted in the trigger; not the id of the record that was inserted prior to firing the trigger.

Options: ReplyQuote


Subject
Views
Written By
Posted
3309
November 05, 2005 04:05PM
Re: LAST_INSERT_ID() question.
1987
November 05, 2005 05:33PM
1916
November 06, 2005 02:01AM
2478
November 06, 2005 07:20AM
1999
November 06, 2005 12:26PM
1907
November 06, 2005 12:44PM
2906
November 06, 2005 04:52PM
1939
November 06, 2005 06:45PM
1813
November 07, 2005 01:44AM
1831
November 07, 2005 09:27AM


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.