Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating a column using only one query ?

Status
Not open for further replies.

Vince75

Chemical
Aug 23, 2004
1
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
 
Replies continue below

Recommended for you

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... :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor