Home » RDBMS Server » Server Utilities » Importing text files (Oracle 10g, SQL Loader, RHEL 5.4)
Importing text files [message #523337] Fri, 16 September 2011 15:16 Go to next message
Messages: 22
Registered: August 2010
Junior Member
Hi all,

I have a rather complicated process to import text files into my DB.
I'm given thousands of files every day, separated by "," and with 80 fields each. With a bash script, I take the 45 fields I need and then split each file into x number of files grouping the rows by three fields.
Then I use SQL Loader to insert them into de DB.

The problem is that now I must insert on two tables and the "WHEN" clause doesn't allow the use of > and <.

To make things a litle clearer take this text file (already splited and grouped and ready to be inserted):
1,1,135,1900,0,12,114,2011/08/25 17:19:00,135,...
1,1,135,1900,0,13,119,2011/08/25 17:19:00,136,...
1,1,135,1900,0,14,117,2011/08/25 17:19:00,137,...
1,1,135,1900,0,15,113,2011/08/25 17:19:00,138,...
1,1,135,1900,0,16,119,2011/08/25 17:19:00,139,...

When field 6 is higher or equal to 14, it must go to table a.
When field 6 is lower than 14, it must go to table b.

I can't use external tables as I'm in a different server.
I hope I made myself clear!
Any help?

Re: Importing text files [message #523339 is a reply to message #523337] Fri, 16 September 2011 15:28 Go to previous message
Messages: 26756
Registered: January 2009
Location: SoCal
Senior Member
sort file based upon field 6.
divide the resultant file into 2 new files where field 6 goes from 13 to 14 & load individual tables with each file
Previous Topic: Impdp Procedure or function Error ORA-00904
Next Topic: transport tablespace
Goto Forum:

Current Time: Sun Nov 29 05:17:15 CST 2020