aspose file tools*
The moose likes JDBC and the fly likes how to compare rows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to compare rows" Watch "how to compare rows" New topic
Author

how to compare rows

aliya sharma
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
I'm fairly new to java.
we have 2 databases (AS400 and SQL Server2000). There's a table in AS400 (named: ORHDR) with fields HORDNO, HOSTAT(P,W,X,) where x stands for "cancelled". In sql server, i have a table named Order with fields order_num, order_status(F,C,A).

i want to search the order table in SQL Server where order_status is "a" and then look up the corrosponding row in AS400. If the HOSTAT is "x", then update the field in SQL server to "C".

I know how to connect to both databases and select statement where order_status is "a". I just don't know how to compare that row with the corrosponding row of AS400 and then update the status adn keep doing this till the whole table is finished.
Any hints or sample code would be greatly appreciated. Thanks for your time

Regards,
Aliya
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the JDBC forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
i can go for just one way. i dont know whether there is some better way.
but we can always get that row as String in our code and update the other on a certain condition. using some loops and if..else.

couldn't we??
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to compare rows
 
Similar Threads
How to update row in CMP
do most databases writelock a row when it's changed?
How to Debug Java Servlets on AS400
SQL injection?
getting latest 100 rows inserted into table