You need to have some way of assigning sequence numbers to the rows.
Consider the following table:
seq number
--- ------
1 1.88
2 9.99
3 8.76
4 9.88
created with:
drop table a;
commit;
create table a (seq integer,num float);
insert into a (seq,num) values (1,1.88);
insert into a (seq,num) values (2,9.99);
insert into a (seq,num) values (3,8.76);
insert into a (seq,num) values (4,9.88);
commit;
You can then execute:
select
ta.seq as aseq,
tb.seq as bseq,
ta.num as anum,
tb.num as bnum,
ta.num - tb.num as diff
from a ta, a tb
where tb.seq > ta.seq;
which will give you:
aseq bseq anum bnum diff
---- ---- ---- ---- -----
1 2 1.88 9.99 -8.11
1 3 1.88 8.76 -6.88
1 4 1.88 9.88 -8.00
2 3 9.99 8.76 1.23
2 4 9.99 9.88 0.11
3 4 8.76 9.88 -1.12