Home » Developer & Programmer » JDeveloper, Java & XML » Compare Contents of two Text Files using Oracle
Compare Contents of two Text Files using Oracle [message #312496] Wed, 09 April 2008 01:07 Go to next message
JasjotS
Messages: 12
Registered: March 2008
Location: India
Junior Member

I have to compare the contents of two text files and then write the common results to a new text file.
Suppose i have a file A with a pipe(|) delimited data, and file B with only one column of data. Now i want to compare the first delimited data field in file A with the Data in file B and for the common fields add the complete row from file A to a new file C.

e.g File A: QWERTY|T|14128989
MOR |M|98123456
& so on....
File B: TWRYUQ
& so on..

Now we need to compare the first delimited field QWERTY with the data in file B i.e. TWRYUQ and in case of similarity, write the complete row (QWERTY|T|14128989) from file A to file C.

NOTE: I want to automate this algorithm since it has to be used everyday.
Re: Compare Contents of two Text Files using Oracle [message #312500 is a reply to message #312496] Wed, 09 April 2008 01:15 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use external tables and SQL.

Regards
Michel
Re: Compare Contents of two Text Files using Oracle [message #312501 is a reply to message #312500] Wed, 09 April 2008 01:24 Go to previous messageGo to next message
JasjotS
Messages: 12
Registered: March 2008
Location: India
Junior Member

Thanx for reply!!

Is there a way it can be done using oracle and data in text files only, and not using tables?
Re: Compare Contents of two Text Files using Oracle [message #312560 is a reply to message #312501] Wed, 09 April 2008 04:38 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
External table is just a way to declare text file in Oracle to be able to use it in SQL.

http://www.oracle.com/pls/db102/search?remark=quick_search&format=ranked&word=external+table&tab_id=

Regards
Michel
Re: Compare Contents of two Text Files using Oracle [message #312608 is a reply to message #312560] Wed, 09 April 2008 07:31 Go to previous message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It's fine with me, but - why would you involve Oracle in something like this? What's wrong with (one of (free?)) operating system tools/programs that allow such things with much less pain?
Previous Topic: JPublisher & oracle dependent code
Next Topic: xml and data storage in warehouse
Goto Forum:
  


Current Time: Thu Mar 28 19:06:50 CDT 2024