Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005

    Unanswered: Updating in a loop using ROWID ?


    I am faced with following situation :

    I use a loop to determine complex calculatoins for a matching record. inside the loop the record (matched by primary key) is updated. Unfortunately a complex update has been realized as too complex (using the loop is up to 10 times quicker).

    Now here is the big question : What is preferred to be used for locating the record? Shall I use the primary key or the table's ROWID?

    Afaik ROWID is the quicker solution, but is safe to use ROWID inside the loop?

    Is there any dependency to the isolation level? Or does the rowid not change when I loop/update it ?

    Thanks ;-))

  2. #2
    Join Date
    Nov 2003
    Provided Answers: 23
    I assume you use a cursor inside the loop.

    Just define the cursor as updateable (... FOR UPDATE OF ..) and use the CURRENT OF keyword for when updating.

    See the PL/SQL Manual for details:

Posting Permissions

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