Help with PL/SQL block!!
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Help with PL/SQL block!!

  1. #1
    Join Date
    Jun 2000
    Location
    dumfries,va,usa
    Posts
    227

    Angry

    Hi all,

    I'm trying to run the statement below but I continue to get the error messages that the Rowid was not declared and v_trans is used incorrectly. This code the trans_no field with values starting from the maximum trans_novalue.

    Can someone please help me debug/rewrite this update code?

    Thanks


    DECLARE
    CURSOR Upd_trans_no IS
    SELECT trans_no,row_id from temp_reimb_control;
    V_counter_num pls_integer := 0;

    BEGIN

    FOR v_trans in Upd_trans_no LOOP
    -- update every record with null trans_no values
    IF v_trans.trans_no is NULL THEN
    -- Increment transaction counter
    v_counter_num := v_counter_num + 1;
    UPDATE temp_reimb_control
    SET trans_no = (select max(trans_no) + v_counter_num from temp_reimb_control)
    WHERE row_id = v_trans.ROW_ID;

    END IF;
    END LOOP;
    commit;
    END;
    /
    leonard905
    leonard905@yahoo.com
    Share on Google+

  2. #2
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    you have a previous thread on development forum, the appropriate one so I am closing this thread

    cheers
    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width