Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2002
    Posts
    162

    Unanswered: Updating values in cursor data sets??

    Is it possible to select a dataset using a cursor and then update a column within that dataset to a different numerical value within the cursor, before re-updating another table with the altered values in the dataset of the cursor???

    for example if the cursor was defined as:

    Cursor c_xyz is select * from opp_project

    can you now do an update like:

    UPDATE c_xyz.column_name SET = 2 (or whatever)

    before doing a permanent update to another table using the altered cursor dataset??
    Last edited by Wale; 11-25-03 at 19:02.

  2. #2
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    140

    Re: Updating values in cursor data sets??

    Hope I got it right...

    Yes, you can update through cursors. You need to slightly change the cursor declaration :

    Cursor c_xyz is select * from opp_project for update of column_name;

    Afterwards, the following statement should do the trick :

    Update opp_project set column_name = 2
    WHERE CURRENT OF c_XYZ

    As you can see, the update is done on table opp_project using the actual "position" of cursor c. Hence, you can consider this change to be "permanent" to table opp_project in case you need it for further usage.

  3. #3
    Join Date
    Mar 2002
    Posts
    162

    Re: Updating values in cursor data sets??

    I do understand this, but my question was if the result set of the cursor could be updated before updating to the table. Sort of like a temp dataset.

  4. #4
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    140
    Not to my knowledge, sorry.

  5. #5
    Join Date
    Mar 2002
    Posts
    162
    Thanks for helping though. I appreciate it.

  6. #6
    Join Date
    Nov 2003
    Location
    Rotterdam, Netherlands
    Posts
    127
    You cannot update a cursor variable!!
    you can lock the records with the cursor and update the table..

Posting Permissions

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