我有类似的调用语句
CALL report_procedure
('2013-02-01',now(),'2015-01-01','1');
我想在选择查询中使用它。 我试过像
Select * from ( CALL report_procedure
('2013-02-01',now(),'2015-01-01','1'));
但是发生错误。 就像
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ( CALL report_procedure ('2013-02-01',now(),'2015-01-01','1') at line 3 0.297 sec
谁能建议我一种在mysql中的Select语句中调用存储过程的方法吗?
最佳答案
无法在 FROM 子句中使用过程的结果集。 MySQL 不允许这样做。
您可以在过程中填充另一个表(或临时表),然后在 SELECT 命令中使用该表 -
CALL report_procedure ('2013-02-01',now(),'2015-01-01','1'); -- fill temp_table
SELECT * FROM temp_table;
关于mysql - 如何在mysql中使用select语句调用存储过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55620501/