How to call a stored procedure using select statement in mysql

后端 未结 2 1239
借酒劲吻你
借酒劲吻你 2020-12-16 03:16

I have call statement like

 CALL report_procedure
(\'2013-02-01\',now(),\'2015-01-01\',\'1\');

and i want to use it in a select query. i h

2条回答
  •  情歌与酒
    2020-12-16 03:36

    It is not possible to use result set from procedure in FROM clause. MySQL does not allow doing this.

    You may populate another table (or temporary table) in your procedure, and after, use that table in SELECT commands -

    CALL report_procedure ('2013-02-01',now(),'2015-01-01','1'); -- fill temp_table
    SELECT * FROM temp_table;
    

提交回复
热议问题