How to update a column with increment in Oracle

Suppose I have a table with two columns named ID, and UserName. When the table is first created ID will have all zeroes in it.
Example:
0     Barry
0     Mary
0     Jane
0     Dan

How would I update this table so that is would add 1 to each value in the ID column starting from the first record in the table. So the end result would look like below.

1    Barry
2    Mary
3    Jane
4    Dan
LVL 2
brgdotnetcontractorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sdstuberCommented:
create table yourtable (id number ,username varchar2(10));


insert into yourtable (id,username) values (0, 'Barry');
insert into yourtable (id,username) values (0, 'Mary');
insert into yourtable (id,username) values (0, 'Jane');
insert into yourtable (id,username) values (0, 'Dan');
commit;

update yourtable set id = rownum;

select * from yourtable;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brgdotnetcontractorAuthor Commented:
Sounds awesome! Thanks. I won't be able to try it until tomorrow. Thanks.
0
brgdotnetcontractorAuthor Commented:
Thanks !!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.