I try to create function in mariadb (latest stable). Want to get all data by company id (int)
CREATE FUNCTION getByCompId (cid INT)
RETURN (SELECT * FROM companies WHERE id=cid);
end when i try to create, i get error:
SQL Error [1064] [42000]: (conn=111) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RETURN (SELECT * FROM cdr WHERE id=cid)' at line 2