Home > database >  If in a stored procedure, use another stored procedure returns a result set
If in a stored procedure, use another stored procedure returns a result set

Time:10-06

In A storage process, select A table, and then in the stored procedure B, call A, how to use A returned result set?

CodePudding user response:

Can't directly call result sets, can put a stored procedure code is also in b, or put a table, the result of the call table data in the b,

CodePudding user response:

Put a temporary table data

CodePudding user response:

 delimiter $$
Create procedure p1 ()
The begin
Create temporary table t1 (id int);
Insert the t1 values (1);
End
$$
Create procedure p2 ()
The begin
Call p1 ();
Select * from t1;
The drop temporary table if the exists t1;
End
$$
Delimiter.
Call the p2;
Drop procedure if the exists (p2);
Drop procedure if the exists p1;

CodePudding user response:

Will result in A store to only temporary tables
  • Related