using some values from a txt file and comparing info from DB and updating the DB
Posted on 2005-04-27
'' I only have these many points left ''
I want to
read a property file
read an input txt file
connect to the DB and load values into a collection
compare the value with the txt file and if OK update a table and if not Ok update another table.
I need to run it on Unix with Oracle DB
I would like to know how to load these property file say p.prt which has the below values
then read a file say test.txt from an input dir compare it with a std .xls file from the std dir for spaces and types
say test.txt file
John 9999 22 USA 100.00
Kim 8888 21 UK 800.00
say std.xls file is as follows
description size type
Name 30 A
id 4 A
age 3 A
country 3 A
amount 10 N
'A' for alphanumeric and 'N' for Numeric
and if the entire file pattern is not OK it should write to a log file and if OK for spaces and types then the log file should be updated as the file is OK then
read each record from the text.txt file
connect to the ORACLE DB using the above property file
and read some values into a collection say
'select m.id , m.age , a.country from member m , address a where m.id = a.id'
and then compare the collection DB values with the test.txt record values for id, age and country and if the test.txt has a record which matches then
update a table uptblMatch with all the values which are matching from the test.txt file
and the records which don't match I have to update in another table uptblMismatch in DB.