update all rows such that doesn't cause duplicate

From: lora <anjela_pat_at_yahoo.com>
Date: Mon, 14 Dec 2009 11:51:24 -0800 (PST)
Message-ID: <55e27851-6206-4ada-b3a7-f2bb07ba71a5_at_21g2000yqj.googlegroups.com>



Hello all,

I've a oracle DB in which one of the VARCHAR2 fields that is part of the key needs to have a substring replaced with another with no special $ character in front of it.

However, when I do this replace, I notice that for a few rows, this would cause a duplicate row and hence get rejected.

So, I'd like to formulate a SQL statement such that all rows would be updated as long as it doesn't lead to duplicates.

Any pointers appreciated!

UPDATE MYTAB SET request = REPLACE(request, '$myString', 'myString') WHERE (operation='myOperation') and request like '%$myString%'; Received on Mon Dec 14 2009 - 13:51:24 CST

Original text of this message