Oracle 10g
I have a table that has a compound key, which I want to replace with a singular key. So I've added an id column. Now I need a single update statement update existing data.
Example:
MyTable(NewID,CMP_Key1,CMP_Key2)
NULL,1,1
NULL,1,2
NULL,2,2
NULL,2,2
Needs to be updated to:
1,1,1
2,1,2
3,2,2
4,2,2
What I've tried so far:
Update MyTable SET NewID = (SELECT ROWNUM FROM DUAL);
Which doesn't work. This will set them all to 1.