PL/SQL Group_ID

Oracle PL/SQL Group_ID Function

The Group_ID function assigns a number to each group resulting from a GROUP BY clause.
For each unique group will return 0. When a duplicated group is found, the group_id function will return a value >0.

Example:

Select sum(sal), deptno, comm, GROUP_ID() 
From emp
Where comm > 100
Group By deptno,
Rollup (deptno, comm);