Topic: the cursor transferred by function parallely from the first
Found out that if sys_refcursor that for some reason at the first start it is always fulfilled not parallely (i.e. despite the parallel plan, it is fulfilled in one flow). From the second time normally. In what there can be a business?
Simple script to play back at itself (oracle 126.96.36.199):
create table t1 (x number, y varchar2 (4000)); create type t_number as table of number; -- To fill a label declare i number; begin for i in 1. 5 loop insert into t1 select i * 100000 + rownum, rpad (owner || object_name, 4000, ' ') from dba_objects; commit; end loop; end; -- At the first start (a hard. ) it is fulfilled always it is serial, at subsequent - it is parallel. declare v_res sys_refcursor; v_arr t_number: = t_number (); type t_arr is table of t1%rowtype; v_val t_arr: = t_arr (); procedure func_returning_cursor (p_ids in t_number, p_ret out sys_refcursor) is begin open p_ret for select / * + parallel (8) */t.* from table (p_ids) p, t1 t where p.column_value = t.x; end; begin v_arr.extend (1000000); for i in 1. 1000000 loop v_arr (i): = i; end loop; func_returning_cursor (v_arr, v_res); fetch v_res bulk collect into v_val; end;