Re: Importing CSV's to Oracle

From: Henry Hayden <gumzilla_at_voicenet.com>
Date: Tue, 08 Jan 2002 21:52:27 GMT
Message-ID: <vSJ_7.3$pl.466_at_news3.voicenet.com>


You have not said what the errors are. But one thing you might want to try is specifying a field
length for the date fields. Here's an example:


LOAD DATA
   INFILE "mydata.txt"
   BADFILE "mydata.bad"
   APPEND INTO TABLE mydata
   FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'

   (INVOICENUM           CHAR,
    STARTDATE            DATE(10) "mm/dd/yyyy" NULLIF startdate = "/  /",
    ENDDATE                DATE(10) "mm/dd/yyyy" NULLIF enddate = "/  /")

=====================================================================

The field width should be equal to the number of characters in the date format string for that field.
I also include the NULLIF clause in case the field (in the CSV file) is empty. Hope this helps.

Henry

"Russell Smith" <rsmith_at_serck-controls.co.uk> wrote in message news:f191bfd4.0201080259.a4cd811_at_posting.google.com...
> I have alot (3gb+) of CSV files to import into oracle, there are
> however a few problems. The data contains dates, in differing
> formats;
>
> 9/10/98 0:11
>
> or
>
> 8-SEP-1998 22:17:00
>
>
> I have used the following but need to be able to do both types at once
> (i don't want to have to pre-process the data before import), any
> suggestions?
>
> LOAD DATA
> INFILE 'C:\test.CSV'
> APPEND
> INTO TABLE SCXDOWNLOAD.HISDAT_A
> FIELDS TERMINATED BY ","
> (cbarow ,
> cbagranule,
> cbarecord,
> cbatime DATE "dd-MON-yyyy/hh24:mi:ss",
> token,
> hisflt,
> status,
> alarm_flag,
> modify_flag,
> insert_flag)
>
> Many thanks
>
> Russell Smith
> Software Projects
Received on Tue Jan 08 2002 - 22:52:27 CET

Original text of this message