The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
TA08-099A: Microsoft Updates for Multiple Vulnerabilities iBot Security Advisories (RSS) 0 04-08-2008 12:30 PM
TA08-087A: Mozilla Updates for Multiple Vulnerabilities iBot Security Advisories (RSS) 0 03-27-2008 01:10 PM
TA08-087B: Cisco Updates for Multiple Vulnerabilities iBot Security Advisories (RSS) 0 03-27-2008 12:40 PM
TA08-079A: Apple Updates for Multiple Vulnerabilities iBot Security Advisories (RSS) 0 03-19-2008 10:30 AM
TA08-079B: MIT Kerberos Updates for Multiple Vulnerabilities iBot Security Advisories (RSS) 0 03-19-2008 10:00 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-02-2005
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,475
multiple updates

Hi all,

I would like to perform multiple updates within a single database open and close.

Box: solaris
dB: informix

This is how i do perform for single update

dbaccess <dbname> -<<EOF
update table1 set col1=1 where col2=1
EOF

i have the col1 values in a file (some 1000 values)
now how do i proceed with an update of 100 values at a time and give a commit. The above sample is time consuming as it has to open and close the database for each and every update done.


And between the dbaccess and EOF i cannot read from the file as within them only database operations are allowed and no file manipulation, storing in variables are allowed.

Any help would be greatly appreciated.

Thanks.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-09-2005
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,475
Hi All,

got the solution myself but in a different way and it is efficient compared to the one i had thought of doing that.

dbaccess <dbname> -<<EOF
update table1 set col1=1 where col2=1
EOF


Instead of
getting the values
opening the database
performing single update
closing the database

Generate the .sql file which generates all the database statements within one begin and commit statement

and that sql file could be fed to the database as

dbaccess <dbname> <.sql filename>

When the i tried the previous method it took some 25 minutes for 12000 records
and in the later method only 3 minutes.

Any ideas welcome.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:20 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0