[英]How to use a mysql stored procedure result set in another stored procedure
I want to filter the result set returned by a stored procedure in side another stored procedure 我想过滤存储过程在另一个存储过程中返回的结果集
Ex: 例如:
delimiter //
create procedure x()
begin
select 1 as a, 2 as b,3 as c;
end //
In y stored procedure I want to select only 'a' column value return from 'x' stored procedure 在y存储过程中,我只想选择从“ x”存储过程返回的“ a”列值
delimiter //
create procedure y()
begin
end//
Maybe this will help. 也许这会有所帮助。
First get result from proc x
into a temporary table tmp
: 首先从proc
x
获取结果到临时表tmp
:
delimiter //
create procedure x()
begin
create temporary table `tmp`
select 1 as a, 2 as b,3 as c;
end //
then call proc x
into proc y
然后将proc
x
调用为proc y
delimiter //
create procedure y()
begin
call x();
select a from tmp;
end //
Finally call y() to result the field a from proc x
select . 最后调用y()以从proc
x
select中得到字段a。
If you want to get only proc x
result then run: 如果只想获取proc
x
结果,请运行:
call x();
select * from tmp;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.