MySql存储过程/函数可以在不使用临时表的情况下返回表吗?
创建以下过程
CREATE PROCEDURE database.getExamples() SELECT * FROM examples;
然后用
CALL database.getExamples()
显示示例表-正如预期的那样-但似乎无法进行以下操作:
SELECT * FROM CALL database.getExamples()
是否可以从存储过程/函数中返回查询结果表,如果可以,怎么办?
就目前而言,这是不可能的。
以下是该子句中可能使用的 文档FROM:
FROM
table_references: table_reference [, table_reference] ... table_reference: table_factor | join_table table_factor: tbl_name [[AS] alias] [index_hint)] | table_subquery [AS] alias | ( table_references ) | { OJ table_reference LEFT OUTER JOIN table_reference ON conditional_expr } join_table: table_reference [INNER | CROSS] JOIN table_factor [join_condition] | table_reference STRAIGHT_JOIN table_factor | table_reference STRAIGHT_JOIN table_factor ON conditional_expr | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor join_condition: ON conditional_expr | USING (column_list) index_hint: USE {INDEX|KEY} [FOR JOIN] (index_list) | IGNORE {INDEX|KEY} [FOR JOIN] (index_list) | FORCE {INDEX|KEY} [FOR JOIN] (index_list) index_list: index_name [, index_name] ...
如您所见,存储过程不在此列表中。