Skip to content
Advertisement

Update Oracle table column with a sequence number based on varchar field in same table

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:

Desired Outcome:

The SELECT statement here gives me the desired results, but when I use it with an UPDATE statement, I receive an error.

The UPDATE statement displays this error:

Thank you in advance for any suggestions.

Advertisement

Answer

You could do this:

I think this would also work in this simple case:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement