Using Oracle, I attempted to write a function that demonstrates how to return the result of a SELECT ... query:
CREATE OR REPLACE FUNCTION f(v1 number) RETURN number IS
BEGIN
IF TRUE THEN
RETURN (select 42 from dual);
ELSE
RETURN v1;
END IF;
END;
But it does not compile.
How can I fix the above IF's RETURN to return 42, i.e. the result of select 42 from DUAL?