Window Functions
Ratio_To_Report
Section titled “Ratio_To_Report”Provides the ratio of the current rows value to all the values within the window.
--DataCREATE TABLE Employees (Name Varchar2(30), Salary Number(10));INSERT INTO Employees Values ('Bob',2500);INSERT INTO Employees Values ('Alice',3500);INSERT INTO Employees Values ('Tom',2700);INSERT INTO Employees Values ('Sue',2000);--QuerySELECT Name, Salary, Ratio_To_Report(Salary) OVER () As RatioFROM EmployeesORDER BY Salary, Name, Ratio;--OutputNAME SALARY RATIO------------------------------ ---------- ----------Sue 2000 .186915888Bob 2500 .23364486Tom 2700 .252336449Alice 3500 .327102804Syntax
Section titled “Syntax”- Ratio_To_Report ( expr ) OVER ( query_partition_clause )