Using `SELECT` as `RETURN` Argument in Function?
Save the result of your query into a variable and return the variable. For example:

CREATE OR REPLACE FUNCTION test_f(v1 number) RETURN number IS
v2 number;
 BEGIN
  IF TRUE THEN
     SELECT 42 into v2 from dual;
     RETURN v2;
   ELSE
     RETURN v1;
   END IF;
 END;


Be sure that your query always generates exactly one row. Otherwise you could get an error if no rows returned or if more than one row is returned.