View Single Post

  #1 (permalink)  
Old 03-21-2008, 09:17 AM
oracle_coorgi oracle_coorgi is offline
Junior Member
 
Join Date: Aug 2007
Posts: 1
oracle_coorgi is on a distinguished road
refcursor type or rowtype

hi
pls advice me who can i go about to get ..
i will be sending date and tp i need to insert and update all in bs from sp,temp_table

Code:
CREATE OR REPLACE package testall as
type ref_all_cur is ref cursor;
procedure allsales_pnt
(
o_SPI OUT  testall.ref_all_cur,
ts_dt  date,
tp   cust_type.tp%type,
);
End testall;
/
CREATE OR REPLACE procedure allsp
(
o_SPI OUT  testall.ref_all_cur,
ts_dt  date,
tp   cust_type.tp%type,
)
as
v_count 				 number;
v_inputted_date 		 date;
begin
open o_spi_id for SELECT pspi FROM sp;
v_dt := TO_DATE('01-'||TO_CHAR(ts_dt,'MON-YYYY'),'DD-MON-YYYY');
v_sdt := TO_DATE('01-'||TO_CHAR(ts_dt,'MON-YYYY'),'DD-MON-YYYY'),-10);
select count(1) into v_count from bs where ts_dt = v_dt
and volt_tp_id = tp;
If v_count = 0 Then
insert into temp_table ---------------
while (v_sdt <= v_dt)
loop
	If tp = 1 Then
	insert into bs ---------------
	commit;
	End If;
	end loop;
	update 	bs----------------
	set 	tp = 5,
			ts_dt=vt_dt,
			pspi = o_spi_id
	where 	volt_tp_id is null;
	commit;
	end allsp;
Reply With Quote