I have a procedure which returns refcursor as OUT parameter.
I need to wrap it inside a new procedure and add new row which depends on one of the refcursors field. As all cursors are immutable I am stuck with this problem. Maybe create temporary table?
DECLARE
initial_cursor SYS_REFCURSOR;
result_cursor SYS_REFCURSOR;
BEGIN
initial_procedure(initial_cursor);
-- add a new row which depends on initial cursors row and wrap it into result cursor.
END;
Lets consider that initial cursor will consist only of boolean values and new row will be varchar 'TRUE' or 'FALSE' (if cursor value is 0 then 'FALSE', else 'TRUE')
You can create a
PIPELINEDfunction to read the cursor and output the rows with an extra row:and then you can use that to make the second cursor:
Which outputs:
db<>fiddle here