I want to combine the data from a table and from a pipelined table function into a single SYS_REFCURSOR. My pipelined table function returns an array of strings
CREATE OR REPLACE FUNCTION function_name
RETURN string_type
PIPELINED
IS
BEGIN
PIPE ROW(pr_package.constant1);
PIPE ROW(pr_package.constant2);
RETURN;
END;
I tried to write the query using a scalar subquery
open cur_TEMP for
Select AR.*,(select * from table(FUNCTION)) from TABLE1 AR
but that throws an error “single-row subquery returns more than one row”.
Since
returns multiple rows, you cannot use it in a scalar subquery. You could do a Cartesian product between the output of the pipelined table function and the table
but it is quite rare that you would intentionally want to generate a Cartesian product. If the table has N rows and the pipelined table function returns M rows, the query I posted will return N * M rows which gets rather large rather quickly. If that’s not what you want, please explain the desired output in a bit more detail.