0

I am trying to use the OR condition in when clause in control file, This this my code in control file :

load data
INFILE 'router.txt'
INTO TABLE ROUTER_ATTLAS_TABLENAME  
APPEND
**WHEN ((1) = 'J' or  (1) = 'D2'  or  (1) = 'vJ' or  (1) = 'VJ' )**
FIELDS TERMINATED BY '\|'

I am getting a error :SQL*Loader-350: Syntax error at line 5.

Expecting ")", found "or".
WHEN ((1) = 'J' or  (1) = 'D2'  or  (1) = 'vJ' or  (1) = 'VJ' )

Please suggest me an correct syntax.

chaya
  • 423
  • 3
  • 11
  • 19
  • I don't think APPEND is to be used here. Check the correct syntax for [LOAD DATA INFILE](http://dev.mysql.com/doc/refman/5.7/en/load-data.html) – moni_dragu Oct 12 '16 at 07:56
  • I saw in one website , They have used 'and ' condition in WHEN clause – chaya Oct 12 '16 at 08:15

2 Answers2

1

I'm afraid OR is not allowed in a WHEN clause: https://docs.oracle.com/cd/B28359_01/server.111/b28319/ldr_control_file.htm#i1005657

Gary_W
  • 9,933
  • 1
  • 22
  • 40
0

You just need two "insert" command in the same table. Copy...

INTO TABLE ROUTER_ATTLAS_TABLENAME
APPEND WHEN ((1) = 'J' or (1) = 'D2' or (1) = 'vJ' or (1) = 'VJ' ) FIELDS TERMINATED BY '\|'

using different WHEN to each desired one.

Sandro
  • 1