Reputation: 4150
Hi Guys I have a table with Multiple column and rows my First Column B2kID is blank I need it Update with values Like:
VC1
VC2
VC3
VC4
.
.
How can I achieve this?
Upvotes: 0
Views: 1612
Reputation: 27880
You could use the rownum
pseudocolumn to get a unique identifier for each of the affected rows, and just use it along with the ||
concatenation operator in a regular UPDATE
sentence:
UPDATE myTable SET B2kID = 'VC' || rownum;
Here is a sample SQLFiddle.
Upvotes: 3
Reputation: 31
The PL/SQL block provided in the following link can be useful. http://searchoracle.techtarget.com/answer/Creating-a-sequence-for-a-varchar-in-PL/SQL
Upvotes: 1
Reputation: 487
You could use ROWNUM
to get a unique number for a record:
UPDATE tableName
SET columnName = 'VC' || ROWNUM
WHERE columnName IS NULL
;
Upvotes: 4