How to use OR in WHEN clause? [message #352384] |
Tue, 07 October 2008 07:37 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
james77
Messages: 1 Registered: October 2008
|
Junior Member |
|
|
Hi,
how can I use OR in WHEN clause.
I will describe my problem:
I have 5 columns and if whichever is not empty, i want to save whole row to DB, but only once.
In manual is that SQL*Loader does not allow the use of OR in the WHEN clause and is necessary to use multiple "INTO TABLE ... WHEN" clauses like
Example on 2 columns:
INTO TABLE my_selective_table
WHEN (01:01) <> ''
(
service_key POSITION(01:11) INTEGER EXTERNAL,
call_b_no POSITION(12:29) CHAR
)
INTO TABLE my_selective_table
WHEN (12:12) <> ''
(
service_key POSITION(01:11) INTEGER EXTERNAL,
call_b_no POSITION(12:29) CHAR
)
But there is error
ORA-00001: unique constraint (string.string) violated
Cause: An UPDATE or INSERT statement attempted to insert a duplicate key. For Trusted Oracle configured in DBMS MAC mode, you may see this message if a duplicate entry exists at a different level.
Anybody have some ideas how it can be solved?
Thanks
Jakub
|
|
|
Re: How to use OR in WHEN clause? [message #352452 is a reply to message #352384] |
Tue, 07 October 2008 14:31 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/43710.gif) |
Barbara Boehmer
Messages: 9104 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
You could use 3 control files and do 3 consecutive loads using append or you could either use SQL*Loader or create an external table to put all of the data into a staging table, then insert into your target table by selecting from the staging table.
|
|
|