Home » RDBMS Server » Server Utilities » WHEN conditions
WHEN conditions [message #74267] Tue, 26 October 2004 03:58 Go to next message
jack
Messages: 123
Registered: September 2000
Senior Member
Sorry if this is a dumb question.  I don't use SQL Loader much.

I have a field defined on input record (let's call it TYP_CD).  I want to reject the record if TYP_CD is either 'R' or 'M'; otherwise I want to load the record.  It didn't like NOT IN.  Any help would be greatly appreciated.
Re: WHEN conditions [message #74269 is a reply to message #74267] Tue, 26 October 2004 06:09 Go to previous messageGo to next message
Raj
Messages: 411
Registered: November 1998
Senior Member
We can write (AND) but we can't write (OR) with when clause in sql loader. the alternate solution is write 2 times that script.

insert
into table tabelname
when ( : )='R'
(field1 pos..
field2 pos..
field3 pod..)

insert
into table tabelname
when ( : )='M'
(field1 pos..
field2 pos..
field3 pod..)
Re: WHEN conditions [message #74270 is a reply to message #74269] Tue, 26 October 2004 08:21 Go to previous messageGo to next message
jack
Messages: 123
Registered: September 2000
Senior Member
Well thanks but that doesn't help. I want to REJECT it when its M or R and insert otherwise. If I read your suggestion correctly, this will insert when its M or R and reject otherwise. Yes?
Re: WHEN conditions [message #74271 is a reply to message #74267] Tue, 26 October 2004 08:51 Go to previous messageGo to next message
Art Metzer
Messages: 2480
Registered: December 2002
Senior Member
----------------------------------------------------------------------
LOAD DATA
INTO TABLE t
WHEN (1) <> 'M' AND (1) <> 'R'
(
    typ_cd POSITION(1:1) CHAR "TRIM(:typ_cd)"
)

----------------------------------------------------------------------
For more on SQL*Loader, click here.
Re: WHEN conditions [message #74272 is a reply to message #74271] Tue, 26 October 2004 10:06 Go to previous messageGo to next message
jack
Messages: 123
Registered: September 2000
Senior Member
Thanks. I thought of that and talked myself out of it (ANDs and NOT EQUALS are always confusing). But having stepped through examples, that seems to work. Thanks again.
Re: WHEN conditions [message #74276 is a reply to message #74270] Wed, 27 October 2004 00:38 Go to previous message
Raj
Messages: 411
Registered: November 1998
Senior Member
in tis case write script mentioned below
insert
into table tabelname
when ( : )<> 'R'
and ( : )<> 'M'
(field1 pos..
field2 pos..
field3 pod..)
Previous Topic: Oracle installation.
Next Topic: SOL LOADER date problem
Goto Forum:
  


Current Time: Mon Jul 01 08:32:26 CDT 2024