I couldn't find solution for this problem.
I have table A with primary key ROW_ID, table B with same extern key and column SOMETHING. Also, I have function created like this:
CREATE FUNCTION FIND_SOMETHING_FOR_ID(ROW_ID INTEGER)
RETURNS TABLE(SOMETHING INTEGER)
BEGIN ATOMIC
RETURN
SELECT SOME_SCALAR_FUNCTION(SOMETHING)
FROM B b
WHERE b.ROW_ID=ROW_ID;
END@
The thing I want to do is: for each ROW_ID in A get table returned by FIND_SOMETHING_FOR_ID and then get UNION of all tables.