Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2013

    Unanswered: How to update 5000 rows looping through 100 different values

    I am new to PLSQL. I do not know how to do following. Any help is appreciated.

    I need to update 5000 rows in a table with 100 values.

    Table A (aid, last, first)
    Table B (bid, newlast) - there are about 100 records in this table
    Table C (cid, key_aid)

    I need to update table A where aid between 1000 and 6000 and aid not in (select key_aid from C)
    a.last needs to be update with newlast. So I need to loop through Table A and loop through table B

    Please explain your answer in details. Thank you.

  2. #2
    Join Date
    Dec 2007
    Richmond, VA
    Provided Answers: 6
    how about you start off in blocks here. Just start with a select. Write the select statement that will get you all rows in a that you will update, then start joining in the other conditions as you've explained them and ensure you are getting the proper new last name. Then convert it to an update.

  3. #3
    Join Date
    Apr 2006
    Provided Answers: 11
    or have a look at declare cursor.. for update
    update ... where current of cursor..
    the other gaps can be filled after reading some chapters or to have a look at provided samples
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5-V11 Fundamentals- DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified

Tags for this Thread

Posting Permissions

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