×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Updating a column using only one query ?

Updating a column using only one query ?

Updating a column using only one query ?

(OP)
Hello !

I have a table which have different fields :
cd_id, desc1, desc2 ...
cd_id being the key

Using java, I have two different arrays :
One contains values I want to use to update the field desc1
The other one containing corresponding cd_id
eg :
desc1[0]=12 cd_id[0]=6
desc1[1]=165 cd_id[1]=68
...

Is that possible to write a single query that would update the desc1 field, putting each value at the correct line ? Now I update each value at a time using a loop, but it just takes forever !!!

Many thanks

Vincent

RE: Updating a column using only one query ?

This is a classical example of importing data from external tables. See your docs of the SQL engine you are using for. If you're updating then you must build yourself the query. As a general rule, don't forget to COMMIT after a number of insertions (updates). Why this process is so slow ? This can be a long debate, since there are so many factors... :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources