How do I successfully call a function which returns a pipelined function from another function ?
-- my_data is a function that returns pipelined function
FUNCTION my_data(rec IN OUT emp.employees%ROWTYPE
)
RETURN out_rows PIPELINED IS
BEGIN
---- logic to populate
PIPE ROW (record_type);
RETURN;
EXCEPTION
WHEN OTHERS THEN
null
END my_data;
-- Below function should call the above one.
FUNCTION function_2(rec IN OUT emp.employees%ROWTYPE
) RETURN out_rows PIPELINED
IS
final_rows_v out_rows ;
BEGIN
select res.* BULK COLLECT INTO final_rows_v
FROM TABLE(my_data(rec)) res;
FOR i in 1..final_rows_v .COUNT LOOP
PIPE ROW(final_rows_v (i));
END LOOP;
return;
END function_2;
I am getting
PLS-00382: expression is of wrong type
PLS-00306: wrong number or types of arguments in call to my_data