我在任何地方都找不到这个答案,但是您可以从 MySQL 中的另一个存储过程调用存储过程吗?我想取回标识值并在父存储过程中使用它.我们不能再使用 FUNCTIONS!
I can't find this answer anywhere, but can you call a Stored Procedure from another Stored Procedure in MySQL? I want to get the Identity Value back and use it in the parent Stored Procedure. We can't use FUNCTIONS anymore!
CREATE PROCEDURE innerproc(OUT param1 INT)
BEGIN
insert into sometable;
SELECT LAST_INSERT_ID() into param1 ;
END
-----------------------------------
CREATE PROCEDURE outerproc()
BEGIN
CALL innerproc(@a);
// @a gives you the result of innerproc
SELECT @a INTO variableinouterproc FROM dual;
END
OUT
参数应该可以帮助您将值返回给调用过程.基于此,解决方案必须是这样的.
OUT
parameters should help you in getting the values back to the calling procedure.Based on that the solution must be something like this.
这篇关于在 MySQL 中的存储过程中调用存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!