I want to make one question about oracle/sql query.
I have some data like below,
Column1
25
20
15
12
11
10
I want to get result like this,
Column1
5 (25-20)
5 (20-15)
3 (15-12)
1 (12-11)
1 (11-10)
I am using cursor to get those results. But, I don’t really want to use cursor, because I have so many rows to calculate. Is there any function to get that results in Oracle/Sql like “Case When,Roll Up”.
These functions are lag() and lead(), see here – http://www.orafaq.com/node/55
They can be used like this –