Bug #15234 | Returning a table as result of a function | ||
---|---|---|---|
Submitted: | 24 Nov 2005 16:55 | Modified: | 26 Nov 2005 17:36 |
Reporter: | Jonnes Bouma | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S4 (Feature request) |
Version: | OS: | Any | |
Assigned to: | CPU Architecture: | Any |
[24 Nov 2005 16:55]
Jonnes Bouma
[26 Nov 2005 14:39]
Valeriy Kravchuk
Thank you for a feature request. But I see no need to add any new features, because stored procedures in MySQL returns any result sets selected in their bodies: mysql> create procedure p() -> select * from t1; -> // Query OK, 0 rows affected (0.00 sec) mysql> call p()// +----+-------------+ | id | txt | +----+-------------+ | 1 | hello world | +----+-------------+ 1 row in set (0.01 sec) Query OK, 0 rows affected (0.03 sec) So, there is a way to do this, already. Functions are for returning values of the predefined data types, not for returning "tables".
[26 Nov 2005 17:36]
Sergei Golubchik
Actually it makes sense to have a function returning a table. Procedure does not return a table, it returns result sets, and you cannot select from them. But such a feature, albeit useful, is not planned for the nearest future, I'm afraid,
[24 Nov 2019 6:16]
JJ Ward
Oracle has implemented this with strong results. Particularly useful for analytic functions. Dynamic manipulation of a JSON array in MySQL 8's JSON_TABLE() can be used as a threadbare workaround, but there needs to be cleaner way of accessing this functionality.