The data from the infile is in the format MM/DD/YYYY
how do I tell the control file to load it into the database as YYYYMM
?
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
Are you trying to load the MM/DD/YYYY data into a char/varchar2 field, or into a date field?
If you're trying to load it into a date field and you want to preserve the day of the month, APC's answer is correct. You can always just present the YYYYMM if that's what you want to do.
If you're trying to load it into a date field and you want to truncate it to the first day of the month, I think something like this would work:
date_column date "MM/DD/YYYY" "trunc(:date_column, 'mm')"
If inserting into a CHAR/VARCHAR2 column, you'd could to transform it a little differently:
vc2_column char "substr(:vc2_column, 7, 4) || substr(:vc2_column, 1, 2)"
When you specify the columns in the INFILE declare just identify the format the data is held in. Like this
Don't worry about the "to" date format. That is only for display purposes. Oracle stores dates in its own internal representation.