Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

replace duplicate values in a table by null

514439Aug 2 2006 — edited Aug 2 2006
Hi
i want to update the table as null where duplicate values are there.
Exmple
name sal
aa 100
bb 100
cc 200
dd 300

is to be updated as
name sal
aa 100
bb
cc 200
dd 300

This query does the job.

update emp a set sal = (select case when a.rowid = min(rowid) then a.sal
else null end from emp b where b.sal=a.sal);
is there any other alterntive mwthod for this.
Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 30 2006
Added on Aug 2 2006
5 comments
537 views