Solved

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

Posted on 2015-02-14
2
585 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

749 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