Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Update of field with consecutive number depening on number of entries

CarstenDDAug 1 2011 — edited Aug 1 2011
Hello,

I need to update a field with consecutive number depending on the number of rows where entries are made which belong together. What does this mean:
I have
SYSAUSPR GEBIET SYSGEBIET TYP RANG
182925 PERSON 600003 4 1
1 PERSON 600004 4 1
2 PERSON 600004 4 1
3 PERSON 600004 4 1
17 PERSON 600004 4 1
18 PERSON 600022 4 1
182864 PERSON 600079 4 1
184082 PERSON 600092 4 1
182774 PERSON 600143 4 1
183237 PERSON 600165 4 1
7 PERSON 600169 4 1
8 PERSON 600169 4 1
9 PERSON 600169 4 1
12 PERSON 600169 4 1
14 PERSON 600169 4 1
184309 PERSON 600179 4 1
23 PERSON 600182 4 1

I need to change column "RANG" from 1 to the number of records which have the same id in column "SYSGEBIET" (starting in this example all with 600) so that it looks like

SYSAUSPR GEBIET SYSGEBIET TYP RANG
182925 PERSON 600003 4 1
1 PERSON 600004 4 *1*
2 PERSON 600004 4 *2*
3 PERSON 600004 4 *3*
17 PERSON 600004 4 *4*
18 PERSON 600022 4 *1*

Does anybody has an idea how to solve this in an update statement?
Thanks for your help
Best regards
Carsten
This post has been answered by Solomon Yakobson on Aug 1 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 29 2011
Added on Aug 1 2011
8 comments
196 views