Home » SQL & PL/SQL » SQL & PL/SQL » Load missing data in SQL Loader
Load missing data in SQL Loader [message #15135] Wed, 22 September 2004 05:22 Go to next message
Pinki
Messages: 5
Registered: September 2004
Junior Member
I have to load data from a csv file to my staging table using SQL loader. Here are a few lines of my data file:

Field names:

date_time,field2,order_num,curr_date_time.

2004-09-07 00:02:13,-,3002109,2004-09-07 00:02:13
2004-09-07 00:01:13,-,3012109,2004-09-07 00:01:13
2004-09-07 00:12:13,-,1002109,2004-09-07 00:12:13
-,-,1002109,-
2004-09-07 02:12:13,-,5002109,2004-09-07 02:12:13

The first column(date field) is the date and time field(date_time).
The second column(varchar2(1)) is a field which had a '-' in it's place(field2).
The third column(number(10) is an order number field.(order_num).
The fourth column(date field) is the current date and time field(curr_date_time).

In the SQL loader control file all the data is getting loaded into the staging table except the date fields. Is there a syntax that I could load the '-' for missing date fields? I am loading the data from SQL server to Oracle database. The date format on the SQL server side is "mm/dd/yyyy hh24:mi:ssam" (the date has an am/pm at the end). In my staging table the date field is varchar2(21) since the date field length is 21 characters on the SQL server. How should I define the date column in my staging table, view and the control file to load all the data fileds?

Please advise.
Re: Load missing data in SQL Loader [message #15139 is a reply to message #15135] Wed, 22 September 2004 06:58 Go to previous messageGo to next message
Ranjit
Messages: 19
Registered: November 1999
Junior Member
Pass NULL if the date column is blank and try the following in your loaded script for date columns.

column1 DATE "YYYY-MM-DD HH:MI:SS" NULLIF column1=BLANKS,

Gud Luck.
RKB
Re: Load missing data in SQL Loader [message #15157 is a reply to message #15139] Thu, 23 September 2004 04:40 Go to previous message
Pinki
Messages: 5
Registered: September 2004
Junior Member
Thanks for the reply and it worked for me with NULLIF (field_name = " ");

Thanks
Pinki
Previous Topic: Print comma in a comma delimited file
Next Topic: UTL_File Directory (Urgent)
Goto Forum:
  


Current Time: Fri Jul 25 00:17:16 CDT 2025