PL/SQL Rank

Oracle PL/SQL Rank Function

The Rank function allow you to rank items in a group.

The Rank Function syntax:

RANK ( ) OVER ( [query_partition_clause] order_by_clause )

Aggregate Function Example

Select rank(1200, 500) WITHIN GROUP (ORDER BY e.sal, e.comm) 
From emp e ;

Analytic Function Example

Select e.ename, e.sal, 
rank() OVER (PARTITION BY e.deptno ORDER BY e.sal) 
From emp e
Where e.job='CLERK';