Calling a Stored Procedure in a Stored Procedure in MySQL

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 parameters should help you in getting the values back to the calling procedure. Based on that the solution must be something like this.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)