MySQL Forums
Forum List  »  Triggers

Obtain primary key value generated by before-insert trigger
Posted by: Ross Goldberg
Date: March 09, 2016 02:21PM

Is there any way to obtain a primary key value generated by a before-insert trigger?

I know that last_insert_id() can return the first value of an auto_increment column from a previous insert, but I can't seem to get it to work with a trigger-generated primary key.

There is no other unique key on my table, so I won't be able to perform a subsequent select to determine the generated primary key from data that was used in the insert.

Options: ReplyQuote


Subject
Views
Written By
Posted
Obtain primary key value generated by before-insert trigger
2880
March 09, 2016 02:21PM


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.