Solved

How to set default value in Oracle SQL*Loader for a date field?

Posted on 2015-02-14
2
649 Views
Last Modified: 2015-02-14
Dear Experts,

I'm importing CSV files using SQL*Loader. One of the fields in the files is in "date" type. Sometimes that field's value comes greater than the sysdate by mistake, causing ora-14400 errors since corresponding date's partition does not exist in the related database table. How can I set this fields's value in control file to sysdate as default in such a condition?

Best Regards.
0
Comment
Question by:GurcanK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
Alexander Eßer [Alex140181] earned 100 total points
ID: 40610154
You should be able to use DECODE and/or CASE..WHEN statements within your control file ;-)
0
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 400 total points
ID: 40610266
The above post is correct.  CASE will work.

Here is a test control file:
LOAD DATA
INFILE *
TRUNCATE INTO TABLE Tab1
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(
col1 char(10) "case when to_date(:col1,'mm/dd/yyyy') > sysdate then sysdate else to_date(:col1,'mm/dd/yyyy') end"
)
begindata
01/01/2014
01/01/2016

Open in new window


Test table:
create table tab1(col1 date);

Open in new window

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Database Design Dilemma 6 71
Oracle performance tuning 2 55
Oracle perfomance issue. 4 49
only show the last 365 days 6 35
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question