Oracle9i enhancement for bulk fetch from cursor variable assigned by Native Dynamic SQL

Consider modifying the Fetch_From_Cursor procedure to use bulk fetch, thus…

create or replace procedure Bulk_Fetch_From_Cursor
  ( p_cursor in sys_refcursor )

is
  type names_t is table of varchar2(4000)
    index by binary_integer;
  the_names names_t;
begin
  fetch p_cursor bulk collect into the_names;


  for j in the_names.first..the_names.last
  loop
    Dbms_Output.Put_Line ( the_names(j) );
  end loop;
end Bulk_Fetch_From_Cursor;
/

It can be invoked with a cursor variable which has been assigned using native dynamic SQL, thus…

declare
  the_cursor sys_refcursor;
begin
  open the_cursor for
    'select last_name from employees order by last_name';

  Bulk_Fetch_From_Cursor ( the_cursor );
  close the_cursor;

  open the_cursor for
    'select department_name from departments order by department_name';
  Bulk_Fetch_From_Cursor ( the_cursor );
  close the_cursor;
end;
/

If this is attempted in a pre-Oracle9i environment (making appropriate substitution for sys_refcursor), then: either bulk fetch can be used when the cursor variable is assigned using static SQL; or explicit row by row fetch can be used when the cursor variable is assigned using native dynamic SQL. But the attempt to do bulk fetch when the cursor variable is assigned using native dynamic SQL causes “ORA-01001: invalid cursor”.