Lets assume we have a table
Table name : test
Name | Value |
Yogesh | 0 |
Yogesh | 0 |
Yogesh | 0 |
Yogesh | 0 |
Yogesh | 0 |
Suresh | 0 |
Suresh | 0 |
Requirement : to insert 1, 2, 3 .... corresponding to values Yogesh
Query to Update :
create sequence seq start with 1 increment by 1; update test set Value=seq.nextval where Name='Yogesh'; commit;
Output :
Name | Value |
Yogesh | 1 |
Yogesh | 2 |
Yogesh | 3 |
Yogesh | 4 |
Yogesh | 5 |
Suresh | 0 |
Suresh | 0 |
No comments:
Post a Comment