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 subtract current value from next value(row) of the same column

515430Apr 13 2009 — edited Apr 14 2009
Hi,

I am struggling to write an SQL query which can do some thing like as shown in the example.

Suppose I have a value column with values like

VALUE
---------------
21138672941
21266223360
21375446692
21464626060
21546520653
21616643777
21689565041
21781762699
21882541342
21983644803
22086697638

My requirement is to write a query to subract 1st row from second, second from third, third from fourth and so on.
The ouput should be 127550419, 109223332 and so on.

Is it possible with a query? Please provide me the query of pl/sql code if this is possible.

Regards
Satish
This post has been answered by rbglossip on Apr 14 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 12 2009
Added on Apr 13 2009
8 comments
8,455 views