Why creating a function for Mysql I got syntax error?

96 Views Asked by At

In Dbeaver 22.2.5 I try to create a function for Mysql 8.0.21, which returns temp table, like

DELIMITER $$

DROP FUNCTION IF EXISTS getUserPermissionTickets$$
CREATE FUNCTION getUserPermissionTickets(permission_id INT, user_id INT)
RETURNS @resultTable TABLE (item varchar(255))
BEGIN
      insert  into @resultTable(item) values('Value')
END  $$

But I got errors :

Error occurred during SQL query execution Reason: SQL Error [1064] [42000]: 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 '@resultTable TABLE (item varchar(255)) BEGIN insert into @resultTable(it' at line 2

I see next : https://prnt.sc/QPvtSV7ZpsIS

How to fix it ?

Thanks in advance!

0

There are 0 best solutions below