Wednesday, July 23, 2008

Date constant with SQL*Loader

How to put a hard coded date (with its own date format, say, YYYY-MM-DD) into one of the fields you are loading with SQL*Loader?

I tried something like
PUT_DATE DATE(10) 'YYYY-MM-DD' "'2008-08-01'"
and it worked on Windows.
But then I found out later that it did not work on Solaris.

The format that works for both is simply:
PUT_DATE "to_date('2008-08-01','YYYY-MM-DD')"

I tried also
PUT_DATE CONSTANT "to_date('2008-08-01','YYYY-MM-DD')"
and it did not work.