hi every one,

how to return table using functions

i tried

DELIMITER $$
DROP function IF EXISTS `test` $$
CREATE function `test`() returns table
begin

return (select * from users);

End $$

DELIMITER ;

error:

Script line: 3 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 'table
begin

return (select * from users);

End' at line 1

A table is not a MySQL data type so a function cannot return a table. You can create a view instead.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.