I am in need of help with the syntax to update an existing field in an oracle table with a new number sequence based on the ordering of another field that is VARCHAR2.
Current Table:
CODE CODE_ORDER
A00 3
A00.0 4
A00.1 6
A00.9 8
Desired Outcome:
CODE CODE_ORDER
A00 1
A00.0 2
A00.1 3
A00.9 4
The SELECT statement here gives me the desired results, but when I use it with an UPDATE statement, I receive an error.
UPDATE Table SET code_order = (select row_number() over (order by
code asc) from Table)
The UPDATE statement displays this error:
ORA-01427: single-row subquery returns more than one row
Thank you in advance for any suggestions.