Re: Update problems ...

From: Luis M Ochoa <mario.ochoa_at_caracas.bbs.ve>
Date: 1995/07/28
Message-ID: <3v9d7gINNh9l_at_intevep.intevep.pdv.com>#1/1


In article <jalford.324.01AB44C7_at_immcms1.redstone.army.mil>, jalford_at_immcms1.redstone.army.mil says...
>
>Hello all,
>
>I am trying to update a table with the statement below, I understand the
>problem, but I don't know how to find it since the table has 60,000 rows.
>Any suggestions ??
>
>
> update ammo set serial_number= rtrim(serial_number)
> where serial_number != rtrim(serial_number);
>
>ERROR at line 1:
>ORA-00001: unique constraint (AMMO.PRIMARY_KEY_AMMO) violated
>
>
>Thank you for your time...
>
> - jack

Hi,
To find the offender, I'd join the table to itself, like in:

 select a.serial_number,b.serial_number
 from ammo a,ammo b
 where a.serial_number<>b.serial_number and <--I don't want the whole table

       a.serial_number=rtrim(b.serial_number)

That will give you two records per offender.

Good luck,

Luis M Ochoa
Cardon, Venezuela Received on Fri Jul 28 1995 - 00:00:00 CEST

Original text of this message