'Read data frm procedure cursor in oracle table valued function

in some query i have to use the result of a procedure that has a cursor as out parameter.

I cannot edit that procedure so i have to use it in that way

here @Connor McDonald suggested me a way to loop cursor but since is too much logic to use it everytime i want to keep that bad thing in a separate function and call that function every time i need that data

i hoped to found a simple solution but even that it is more complex than I was hoping for, i cannot simply write declare a cursor variable and use it in function body

now i'm here:

FUNCTION t_fnc_NAME (p_codUtente varchar2) return  t_rec_NAME pipelined IS
outRec   rec_NAME;
CURSOR c_NAME IS

SELECT 1 AS ID FROM dual;
  
    BEGIN

    FOR crec in c_NAME LOOP
        outRec.COD_1 := crec.ID;
        pipe row (outRec);
    END LOOP;
RETURN;
END t_fnc_NAME;

how can i replace select 1 from dual with a call to the out parameter of that procedure:

PROCEDURE GET_DATA (
   RS                   OUT CURSOR_TYPE_NAME,
  p_codUtente 
   )

thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source