The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to convert Fixed length file to delimited file. satyam_sat Shell Programming and Scripting 7 04-02-2008 11:41 PM
Manipulating a fixed length file w/o PERL dabear Shell Programming and Scripting 4 03-31-2008 01:33 PM
What the command to find out the record length of a fixed length file? tranq01 UNIX for Dummies Questions & Answers 3 10-19-2007 11:16 AM
convert XML file into Text file(fixed length) ram2s2001 Shell Programming and Scripting 0 11-02-2005 09:28 PM
creating a fixed length output from a variable length input r1500 Shell Programming and Scripting 2 12-03-2003 09:09 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-09-2007
Registered User
 

Join Date: Aug 2007
Posts: 26
Stumble this Post!
use SQL loader to dump a fixed length file in to DB

consider a fixed length file

12345abcd8901
12345abcd7777
12345njdu8888
12345hdku8388


i would like to dump it in to oracle DB using sql loader
12345 in to first coloumn
abcd in to second coloumn
8901 in to 3rd coloumn
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-10-2007
dj -------
 

Join Date: Feb 2007
Location: Cochin/Bangalore, India
Posts: 380
Stumble this Post!
Two steps

1.Make a csv file

Code:
awk 'BEGIN{FIELDWIDTHS = "5 4 4"}; {print $1","$2","$3;}' filename
2.
Code:
load data
          infile 'filename.csv'
		  into table tablename
          fields terminated by ","
Reply With Quote
  #3 (permalink)  
Old 10-10-2007
Registered User
 

Join Date: Jun 2004
Posts: 146
Stumble this Post!
You can edit the control file of the sqlloader by the following:

Code:
LOAD DATA
INFILE <data_file_path_and_name>
INTO TABLE <table_name> (
<column_name> POSITION(<integer>:<integer>) <data_type>,
<column_name> POSITION(<integer>:<integer>) <data_type>,
<column_name> POSITION(<integer>:<integer>) <data_type>)

I.e:
LOAD DATA
   INFILE /tmp/load_data.dat
   INTO TABLE t1
     (col1 POSITION(1:5) ,
      col2 POSITION(6:9) , 
      col3 POSITION(10:13))
Regards,
Nir
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:40 AM.


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