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!
It is quite possible that a MySQL stored procedure can call another MySQL stored procedure inside it. To demonstrate it, we are taking an example in which a stored procedure will call another stored procedure to find out the last_insert_id.
You can call the stored procedure inside another stored procedure; the JavaScript in the outer stored procedure can retrieve and store the output of the inner stored procedure.
Answer is Yes.You can call a procedure within a table function as long as the procedure is read only.
Calling one stored program from another is perfectly simple. You do this with the CALL statement, just as you would from the MySQL command-line client. Figure 2-15 shows a simple stored procedure that chooses between two stored procedures based on an input parameter.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With