Home » RDBMS Server » Server Utilities » Case statement with in the control file?
Case statement with in the control file? [message #149530] Fri, 02 December 2005 02:23 Go to next message
Delta1
Messages: 1
Registered: December 2005
Junior Member
I am pretty sure that you can use a case statement in place of a decode with the control file but could some one provide me with the syntax please?

Many thanks
Re: Case statement with in the control file? [message #149974 is a reply to message #149530] Mon, 05 December 2005 20:19 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
oracle@mutation#desc mutation scott.mytable

Table:scott.mytable
           Name                      Null?    Type
           ------------------------- -------- ------------------------
    1      ID                                 VARCHAR2(30)

oracle@mutation#cat myctl.ctl
LOAD DATA
INFILE 'mydata.data'
append
INTO TABLE mytable
fields terminated by ',' optionally enclosed by '"' trailing nullcols
(id "case :id
        when 'r1'then 'another record'
        when 'r2'then 'someother record'
        else 'somejunkdata'
        END")

oracle@mutation#cat mydata.data
r
r1
r2
x
oracle@mutation#sqlldr userid=scott/tiger control=myctl.ctl

SQL*Loader: Release 9.2.0.4.0 - Production on Mon Dec 5 21:19:28 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Commit point reached - logical record count 4
oracle@mutation#query mutation scott.mytable

ID
------------------------------
somejunkdata
another record
someother record
somejunkdata

oracle@mutation#
Previous Topic: Sending Data To Web
Next Topic: how to stop sql loader if any row is bad
Goto Forum:
  


Current Time: Tue Jul 02 05:29:40 CDT 2024