oracle - How can I serve the collection to cursor parameter? -


please find rc1 in code. want return v_teminatkayit collection cursor. how can it?

this not work;

 open rc1  select *    table(cast(v_teminatkayit t_teminattip)); 

this not working? how can return collection cursor out parameter!?3

 create or replace procedure krd_sel_gnakdiriskdetay_sp     (        p_musterino in number default 0,        rc1         in out sys_refcursor,        rc2         in out sys_refcursor     )        v_rcrteminat       sys_refcursor;        v_urunadi          varchar2(80);        v_risktutar        number(26, 2);        v_gnakdirisktoplam number(26, 2) := 0;        v_kullandirimtarih date;        v_vade             date;        v_muhatap          varchar2(300);        v_konu             varchar2(600);        type t_teminattip record(           v_urunadi   varchar2(80),           v_mektupttr number(26, 2),           v_mektuptar date,           v_kkrvade   date,           v_muhatap   varchar2(300),           v_konu      varchar2(600));         type t_teminatbilgi table of t_teminattip index binary_integer;        v_teminatkayit t_teminatbilgi;      begin        begin           krd_sel_teminatmektuprisk_sp(p_musterino => p_musterino, rc1 => v_rcrteminat);           if v_rcrteminat%isopen              fetch v_rcrteminat bulk collect                 v_teminatkayit;            end if;        -- how can serve collection cursor parameter ?           open rc1              select *                table(cast(v_teminatkayit t_teminattip));          exception           when others              raise_application_error(-20101, '');        end;      end krd_sel_gnakdiriskdetay_sp; 

you're trying fetch unknown quantity of data memory can work it, not common programming practice in pl/sql. in small database might fine - let's imagine moment database big database, , you're working big data, , open query returns 100 million rows without realizing how large return set be, , try bulk collect in-memory collection. if you're lucky cause process crash. if you're less lucky might cause database instance go down, make dba somewhere very, unhappy. , if you're really having bad day bring down server which, while may amusing watch afar, not fun when you're close action - when 3 dba's, 2 sysadmins, , manager red face appear in cubicle shouting, "what did do?!?!?!?". really, not fun. don't ask me how know... :-}

if want return cursor routine, best bet rewrite routine that:

create or replace procedure krd_sel_gnakdiriskdetay_sp   (   p_musterino in number default 0,   rc1         in out sys_refcursor,   rc2         in out sys_refcursor   ) begin   begin     krd_sel_teminatmektuprisk_sp(p_musterino => p_musterino, rc1 => rc1);   exception     when others       raise_application_error(-20101, '');   end; end krd_sel_gnakdiriskdetay_sp; 

it appears krd_sel_teminatmektuprisk_sp kind enough open cursor - you're done. caller of krd_sel_gnakdiriskdetay_sp should read cursor (which going anyways, right?) in whatever manner appropriate.

best of luck.

share , enjoy.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -