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
3499
November 05, 2005 04:05PM
Re: LAST_INSERT_ID() question.
2116
November 05, 2005 05:33PM
2025
November 06, 2005 02:01AM
2604
November 06, 2005 07:20AM
2103
November 06, 2005 12:26PM
2000
November 06, 2005 12:44PM
3002
November 06, 2005 04:52PM
2044
November 06, 2005 06:45PM
1918
November 07, 2005 01:44AM
1924
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.