How to use sqlloader with date mask?


I need to load a file in to oracle the data looks like this:

CDX375XXXXX    ,Nov 23 1988 12:00:00:000AM,,Nov  3 1998 12:00:00:000AM ,90000

the first column contains the acct #
the second column contains a date and time. this is my problem.
how do you create a mask for the date and tell sqlloader to ignore the time?

the file is comma delimited and varys in lenght so I cant pluck out the date by position.

The acutal files I need to load are huge so I perfer not to write a sed program to strip out the time portion if sql loader can do it directly.



Ans1:

Put the SQL*Loader date mask to read the entire date and time and add an SQL
command to trunc the time. Something like this :

first_set date "YYYY/MM/DD HH24:MI:SS" "trunc(:FIRST_SET)",

The mask is not good in my example but you see the point....

Regards,

Marc Mazerolle



Ans2:

Good options. If first_date would always need the time part to be removed,
then another option would be a database trigger:

    create or replace triiger biu_my_table
        on insert or update on my_table
        for each row
    begin
        :new.first_date := trunc( :new.first_date);
    end;
    /
    show errors

Arjan.

Hosted by www.Geocities.ws

1