[英]MySQL - Output of last select in procedure with update and insert
I have a stored procedure that executes the following statements: 我有一个执行以下语句的存储过程:
The SP is returning the first variable, since it is the first select. SP正在返回第一个变量,因为它是第一个选择。
Is there any way I can retrieve that last insert id, instead? 有什么办法可以代替我获取最后一个插入ID?
I know I could use the last insert id on my application's cursor, but that breaks a model I'm using. 我知道我可以在应用程序的游标上使用最后一个插入ID,但这会破坏我正在使用的模型。 I suppose I could do that as a last resort, but I'm searching for additional options.
我想我可以作为最后的选择,但是我正在寻找其他选项。
您可以在存储过程中使用OUPUT参数,存储最后插入ID的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.