且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 MySQL 中的存储过程中调用存储过程

更新时间:2022-02-25 22:15:56

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.