SERPland Flugverkehr/Airtraffic Zürich – Auto Direktimport Dänemark – Disneyland Paris – Legoland Deutschland

15Jul/110

Oracle Sum Function

The Oracle Sum fuction is very useful. Also analytical Oracle Sum functions are available. Using sum(<column>) over (partition by <column>): with this oracle sum function, you can sum over a range within the result set.

Sample: I have 526 Rows of payed bills, unfortunatelly within this view I get bills with their position in the same view (not normalized). With this oracle sum function, I calculate a sum of all positions within its bill.

select persnr ,billnr ,positionnr ,betrag ,currency ,sum(betrag) over (partition by persnr, rechnungnr order by persnr, to_number(billnr),to_number(positionnr)) as oracle_sum   -- oracle sum function  from billing_view where 1=1 and persnr = 37797

Related Posts: