Exforsys
+ Reply to Thread
Results 1 to 2 of 2

refcursor type or rowtype

This is a discussion on refcursor type or rowtype within the Oracle Database forums, part of the Database category; hi pls advice me who can i go about to get .. i will be sending date and tp i ...

  1. #1
    oracle_coorgi is offline Junior Member Array
    Join Date
    Aug 2007
    Answers
    1

    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;



  2. #2
    grlewycky's Avatar
    grlewycky is offline Junior Member Array
    Join Date
    Jan 2007
    Answers
    6
    After your CURSOR definitions and before your BEGIN

    add something like this:


    inv_record C_INVOICE%ROWTYPE;


    CURSOR c_machine IS
    Select name from v$database;
    ----
    /*--------------------------------*/
    /* */
    /* */

    machine_record c_machine%ROWTYPE;

    /* */
    /* */
    /*--------------------------------*/
    BEGIN

    OPEN c_machine;
    LOOP
    FETCH c_machine INTO machine_record;
    out_machine := machine_record.NAME;
    EXIT WHEN c_machine%NOTFOUND;
    end loop;
    CLOSE c_machine;


Latest Article

Network Security Risk Assessment and Measurement

Read More...