title: How to use decode in sql-loader?
body: <p>I use sqlldr to import CSV files and I have some problem with date multiple formats.</p>
  
  <p>Dates inside the CSV file are <strong>DD/MM/YYYY</strong> and if <strong>there is no date it is a single dot</strong></p>
  
  <hr>
  
  <h2>CSV file</h2>
  
  <hr>
  
  <pre><code>DATE_COLUMN;OTHER_COLUMN
  01/01/2013;other column content 1
  .;other column content 2
  </code></pre>
  
  <hr>
  
  <h2>My .ctl file for sqlldr</h2>
  
  <hr>
  
  <pre><code>LOAD DATA
  INFILE '/path/to/my/file.csv'
  REPLACE INTO TABLE table_to_fill
  FIELDS TERMINATED BY ';'
  (
  COLUMNDATE "decode(:COLUMNDATE ,NULL,'.', to_date(:COLUMNDATE ,'DD/MM/YYYY'))",
  OTHER_COLUMN
  )
  </code></pre>
  
  <p>The import is working when I use :</p>
  
  <pre><code>decode(:COLUMNDATE ,NULL,'.'))
  </code></pre>
  
  <p>or</p>
  
  <pre><code>to_date(:COLUMNDATE ,'DD/MM/YYYY')
  </code></pre>
  
  <p>But not when I try to combine both...</p>
  
  <p>Here is the error log :</p>
  
  <pre><code>Record 1: Rejected - Error on table table_to_fill, column COLUMNDATE.
  ORA-01858: a non-numeric character was found where a numeric was expected
  </code></pre>
  
  <p>How can I combine these, please ?</p>
  
  <p>I thought that the last parameter of the "decode" function was for the default value of the column, am I wrong ?</p>