SQL Loader question to import from a comma separated values file
Posted on 2003-12-08
I created this new dB to keep track of daily Exchange rates. At the moment lets say I can obtain a two line, comma separated values (CSV) file as follows:
Date, USD, JPY, DKK, GBP, SEK, CHF, ISK, NOK, BGN, CYP, CZK, EEK, HUF, LTL, LVL, MTL, PLN, ROL, SIT, SKK, TRL, AUD, CAD, HKD, NZD, SGD, KRW, ZAR,
4 December 2003, 1.2074, 130.67, 7.4415, 0.70045, 8.9630, 1.5579, 89.47, 8.0905, 1.9520, 0.58360, 32.293, 15.6466, 270.30, 3.4530, 0.6571, 0.4296, 4.6484, 40338, 236.5000, 41.014, 1756611, 1.6421, 1.5785, 9.3772, 1.8684, 2.0728, 1437.71, 7.4660,
But, I only need the following information to be entered and not everything: Date, USD, JPY, GBP, AUD.
How can I load this into my dB using SQL*Loader and skip the rest? basically I want to choose the columns to be enter into my dB. Also, I may have to keep in mind that the order of the exchange rates in the csv file may change somewhere down the line when I obtain it.
so, is there any way to explicitly tell the SQL*Loader which columns to load, i.e. somehow use a "Where" type of command and search for USD, or JPY and then load this particular data?
say my SID is FX
table name: FX_RATES table
Date - Sysdate
EUR - Number(1) - will always be 1, representing the exchange rate to 1 Euro.
USD - Number(11,5)
JPY - Number(11,5)
GBP - Number(11,5)
AUD - Number(11,5)
I currently can input the data as follows:
insert into FX_RATES
values(sysdate, 1, 1.2074, 130.67, 0.70045, 1.6421 );
Please let me know how I can script this is SQL to automate the proces and load the date with SQL Loader.
Your help is greatly appreciated. Thank you very much.