create or replace package pkg_test
as
type mytype is ref cursor;
end;
/
create or replace procedure name_pro(p_rc out pkg_test.mytype)
as
str varchar2(100);
begin
str:='select (select col_name from b where id=a.id),(select col_name from c where id=a.id),.... from a';
open p_rc for str;
end;
/