我想过滤另一个存储过程中的存储过程返回的结果集
例如:
delimiter //
create procedure x()
begin
select 1 as a, 2 as b,3 as c;
end //
在 y 存储过程中,我只想选择从“x”存储过程返回的“a”列值
delimiter //
create procedure y()
begin
end//
最佳答案
也许这会有所帮助。
首先将 proc x
的结果放入临时表 tmp
:
delimiter //
create procedure x()
begin
create temporary table `tmp`
select 1 as a, 2 as b,3 as c;
end //
然后调用 proc x
到 proc y
delimiter //
create procedure y()
begin
call x();
select a from tmp;
end //
最后调用 y() 从 proc x
select 中获取字段 a 。
如果您只想获取 proc x
结果,则运行:
call x();
select * from tmp;
关于mysql - 如何在另一个存储过程中使用mysql存储过程结果集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39254351/