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!

How to update the previous value from the same column

3408387May 3 2017 — edited May 4 2017

Hi Gurus,

I have below data sample, I want to update 1 on every record in B1 till i get 15 , once i get 15 i will have to update 15 to all 0 till 33 and goes on... please check my data sample so my question would be very clear. Also for convenience we have A1 column which corresponds to B1 values in a sequence way.

I tried in many ways but unable to get the right result, Please suggest me the way. Thank you.

  A1    B1

11
20
30
40
50
60
70
80
90
100
110
120
130
140
1515
160
170
180
190
200
210
220
230
240
250
260
270
280
290
300
310
320
3333
340
350
360
3737
380
390
400
410
420
430
440
450
460
470
930
940
950
960
970
980
990
1000
101101

EXPECTED OUTPUT :

A1 B1

1 1

2 1

3 1

4 1

5 1

6 1

7 1

8 1

9 1

10 1

11 1

12 1

13 1

14 1

15 15

16 15

17 15

18 15

19 15

20 15

21 15

22 15

23 15

24 15

25 15

26 15

27 15

28 15

29 15

30 15

31 15

32 15

33 33

34 33

35 33

36 33

37 37

38 37

39 37

40 37

41 37

42 37

43 37

44 37

45 37

46 37

47 37

93 37

94 37

95 37

96 37

97 37

98 37

99 37

100 37

101 101

This post has been answered by Frank Kulash on May 3 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 1 2017
Added on May 3 2017
5 comments
1,224 views