我想将PROCEDURE的输出存储到全局用户定义的VAR中,这样我就可以在其他数据库的其他PROCEDURE中使用这个“列表”。
其次,如果在第二个PROCEDURE上使用VAR,则应该取消设置,因为在下一个CALL上它会附加或?
感谢您的回复!
BEGIN
SELECT `steamid` FROM `mybb_users` WHERE `steamid`!='';
END
SELECT shout进入全局变量,所以我可以在另一个过程中使用结果......
答案 0 :(得分:1)
据我所知,由于MySQL中的过程,您无法返回行集。
我会通过在第一个过程中创建一个临时表来解决它,然后在第二个过程中使用该临时表。像这样:
delimiter $$
create procedure procedure1()
begin
drop table if exists temp_table;
create temporary table temp_table
select steamid from mybb_users where steamid != '';
-- add the appropriate indexes here
-- alter table temp_table
-- add index ...
end $$
create procedure procedure2()
begin
-- Do whatever you want to do with temp_table
end $$
delimiter ;
记住: