If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > SQL LOADER and multiple WHEN conditions

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Oct 2004
Location: Oklahoma City OK -
Posts: 122
SQL LOADER and multiple WHEN conditions

I need to load data into a table when a certain column is not '000000' ( a header record) and also when another column not = 'AA' ( a detail record).

Is the following correct? I am unable to find an example like this.

...
LOAD DATA
INFILE '/Dynamically_Generated/tpp_data_in.dat'
REPLACE
INTO TABLE myschema.TR_TABLE_NAME
WHEN DOC_ID <> '0000000000000000' AND
ITEM_A <> 'SA'
( ITEM_A POSITION(4:5)
, DOC_ID POSITION(60:75) CHAR


.....
all documentation I have read indicates only 'AND' to be used in 'WHEN' clause.

Thanks for your help.

wrwelden
Reply With Quote
  #2 (permalink)  
Old
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,982
This is an excerpt of a document you can find here:
Quote:
A WHEN clause can contain several comparisons, provided each is preceded by AND. Parentheses are optional, but should be used for clarity with multiple comparisons joined by AND, for example:

WHEN (deptno = '10') AND (job = 'SALES')
Therefore, I'd say your condition might work. Did you try it, anyway? Were the results OK?
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Oct 2004
Location: Oklahoma City OK -
Posts: 122
answer to littlefoot. It worked fine.

When I posted, the system was down. Upon testing, it did work fine. I was uncertain that it would work correctly because no single row contained both conditions, so I thought the undesired results of no rows discarded may have been the results.

Thanks,
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On