I need to create a function that reads its result from a table, so I need to use a SELECT statement to read the output. Something like that:
CREATE FUNCTION mydb.rate(a CHAR(3))......RETURN SELECT b FROM mytable WHERE x = a;
I'm not sure if this syntax is allowed. Couldn't find similar example in the docs.
Stored procedure is also an option, but the problem is I need to call it INLINE like that:
SELECT 100*sp_(a) FROM sometable;
and I'm not sure if this achievable.
Any idea or advice is welcome!
rights to materials on this website, the rights you grant to your submissions to this website, and your responsibilities regarding your conduct on this website.