Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL*Loader- null dates in data source are " / / "

Status
Not open for further replies.

pdtt

Programmer
Sep 24, 2002
35
0
0
CA
Hi,

The data source files I am trying to load have a " / / "
mask when the date column is null. Does anyone know how to deal with this. Is there an oracle function in 8.1.7 that can test for a valid date like the VB function IsDate()?

Thank you
 
Hi,

You can use a decode in the control file to insert NULL :
decode(field,' / / ',NULL,to_date(field,DD/MM/YY'))

Hope it helps,
Rgds,
Did02
 
Hi Did02,

Thanks for the reply. I have tried a few variations of
syntax and I am getting the same error whenever I try
to use an Oracle function. Here is a portion of my control file.
FOREIGN_CD Char,
LAST_VISIT DATE "MM/DD/YYYY" decode (LAST_VISIT,' / / ',NULL,to_date(LAST_VISIT, "MM/DD/YYYY"),
NO_VISIT Integer External,

I have tried the LAST_VISIT line without the date mask, withouth the DATE and date Mask and I still get the following error. What am I messing up with the syntax. my attempts at using Oracle functions in the control files always give an error.

SQL*Loader-350: Syntax error at line 24.
Expecting "," or ")", found "decode".
LAST_VISIT DATE "MM/DD/YYYY" decode(LAST_VISIT,' / / ',NULL,t

Thanks
 
Pdtt,

Try this in your control file:
LAST_VISIT DATE "MM/DD/YYYY" NULLIF reference_dt=' / / ',
or
LAST_VISIT CHAR "TO_DATE(DECODE:)LAST_VISIT, ' / / ',NULL, :LAST_VISIT),'MM/DD/YYYY')" ,

Both solutions should be ok.
Rgds,
Did02
 
you should always put the function in " ". the Decode function should work if you put it in " "
 
Thank you did02 the LAST_VISIT DATE "MM/DD/YYYY" NULLIF reference_dt=' / / ', worked well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top