oracle - Stored procedure created but not returning output -
i have created stored procedure - it's created on server when executing it, procedure completed
message, it's not returning output.
procedure below
create or replace procedure dfadmin.usp_getpicklist_df ( p_ord_type in varchar2, p_picklist_out out sys_refcursor, p_picklist_ord out sys_refcursor ) v_totalopenorder integer; v_astockqty integer; v_bstockqty integer; v_loopcounter integer; v_astock integer; v_bstock integer; v_totalbstockqty integer; begin select count(distinct ord_nbr) v_totalopenorder dfadmin.df_orders ord_status='open' , ord_type='df'; begin if v_totalopenorder>0 v_bstockqty:=round(((v_totalopenorder*60)/100),0); v_astockqty:=v_totalopenorder-v_bstockqty; select count(1) v_astock dfadmin.ro_hist process='astock' , order_type='df'; select count(1) v_bstock dfadmin.ro_hist process='bstock' , order_type='df'; if (v_bstock < v_bstockqty) open p_picklist_out select t.qty,t.putaway_bin bin,t.boxid box_id ,t.pickqty pick_qty ( select sum(i.qty) qty, i.putaway_bin,i.boxid,'1' pickqty (select * dfadmin.ro_hist order_type='df' , qty<=v_bstock order created_date asc ) boxid in (select k.boxid dfadmin.ro_hist k) , i.process='bstock' , i.putaway_bin not null , qty<=v_bstock group i.putaway_bin,i.boxid,i.qty, i.process,'1' union select sum(i.qty) qty, i.putaway_bin,i.boxid,'1' pickqty (select * dfadmin.ro_hist order_type='df' order created_date asc ) boxid in (select k.boxid dfadmin.ro_hist k ) , i.process='astock' , i.putaway_bin not null , qty<=(v_totalopenorder-v_bstock) --and case when v_bstock>0 rownum<=(v_totalopenorder-v_bstock) else rownum>0 end group i.putaway_bin,i.boxid,i.qty, i.process,'1' ) t order t.qty asc; open p_picklist_ord select distinct ord_nbr,'' qty,'' bin,'' box_id ,'' pick_qty dfadmin.df_orders ord_status='open' , ord_type='df' ; else begin open p_picklist_out select t.qty,t.putaway_bin bin,t.boxid box_id ,t.pickqty pick_qty ( select sum(i.qty) qty, i.putaway_bin,i.boxid,'1' pickqty (select * dfadmin.ro_hist order_type='df' , qty<=v_bstock order created_date asc ) boxid in (select k.boxid dfadmin.ro_hist k ) , i.process='bstock' , i.putaway_bin not null , qty<=v_bstockqty group i.putaway_bin,i.boxid,i.qty, i.process,'1' union select sum(i.qty) qty, i.putaway_bin,i.boxid,'1' pickqty (select * dfadmin.ro_hist order_type='df' order created_date asc ) boxid in (select k.boxid dfadmin.ro_hist k ) , i.process='astock' , i.putaway_bin not null , qty<=(v_totalopenorder-v_bstockqty) --and case when v_bstock>0 rownum<=(v_totalopenorder-v_bstock) else rownum>0 end group i.putaway_bin,i.boxid,i.qty, i.process,'1' ) t order t.qty asc; open p_picklist_ord select distinct ord_nbr,'' qty,'' bin,'' box_id ,'' pick_qty dfadmin.df_orders ord_status='open' , ord_type='df'; end ; end if; end if; end; end usp_getpicklist_df;
in procedure there 1 input parameter , 2 output parameter.
in procedure, there no dbms_output
or similar, lead output/display of data.
there 2 output parameters of sys_refcursor type, suppose considering desired output content of these parameters after procedure execution. after call of procedure can fetch these cursors variables , e.g. display data this.
declare vpicklist_out sys_refcursor; vpicklist_ord sys_refcursor; myrecord mytable%rowtype; begin usp_getpicklist_df('somestring', vpicklist_out ,vpicklist_ord ); loop fetch vpicklist_out myrecord1; exit when vpicklist_out%notfound; dbms_output.put_line(to_char(myrecord1.col1)); end loop; end;
note, don't know exact structure of data, myrecord in example declared rowtype
of table called mytable.
Comments
Post a Comment