Results 1 to 3 of 3
  1. #1
    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

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,005
    This is an excerpt of a document you can find here:
    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?

  3. #3
    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,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •