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!

How to append a number to the end of a string?

782237Oct 6 2010 — edited Oct 7 2010
Hi SQL gurus

I have a problem...

I am trying to modify a bunch of records so that the unique key (of varchar2 -type) in them gets a number at the end.

The SQL script I am using looks like this (just with more names in it)...

UPDATE PERSONS
SET NAME = NAME ||to_char(rownum)
WHERE NAME IN (
'BIJOY',
'JOSE',
'LARSON',
'ADEL')

In the persons table the "NAME" column needs to be unique.

The problem is that I get the "unique constraint violated" (00001) error when attempting to execute the script.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 4 2010
Added on Oct 6 2010
3 comments
1,287 views