Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: sql*loader default value

RE: sql*loader default value

From: Bala, Prakash <prakash.bala_at_cingular.com>
Date: Tue, 03 Apr 2001 09:09:18 -0700
Message-ID: <F001.002DFB36.20010403084028@fatcity.com>

Gregory,

On doing some research, found that a number column can be populated with a 0 using the direct load path, if the input value is null by having the following line in the control file:

  field1 integer external defaultif (field1 = 'NULL')

But the same thing doesn't work for char columns. So you are right!

Prakash

-----Original Message-----
[mailto:gregory.t.norris_at_mail.sprint.com] Sent: Tuesday, April 03, 2001 11:20 AM
To: Multiple recipients of list ORACLE-L

Thanx to Witold and Prakash for suggesting NULLIF and DEFAULTIF. Unfortunately, it looks like both of those do basically the opposite of what I'm trying to accomplish. Essentially, I want to prevent sql*loader from ever inserting NULL in a column (which may not be numeric), substituting whatever value is appropriate for the given application instead. Something like using "nvl(:field,'unknown')" in the field specification of the control file for conventional path loads.

As far as I can see, there's no way to do this within sql*loader itself. So the choices would be to run a cleanup just after the load
(which may or may not negate the speed benefits of using direct path),
or to somehow pre-process the data file to fill in the missing values
(perhaps an awk or perl script). Of course, if I'm missing something
obvious please let me know... the sql*loader documentation seems designed to confuse. (-:

Cheers!

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Bala, Prakash
  INET: prakash.bala_at_cingular.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L

(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
Received on Tue Apr 03 2001 - 11:09:18 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US