GROUP_ID is an advanced function that the Oracle database supports. It is used to assign a number to each group resulting from a GROUP BY clause. The GROUP_ID function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g and Oracle 9i.
SELECT column1, column2, ... column_n, GROUP_ID() FROM tables WHERE conditions GROUP BY column1, column2, ... column_n;
SELECT SUM(marks), class, extra_marks, GROUP_ID() FROM students WHERE extra_marks > 10 GROUP BY class, ROLLUP (class, extra_marks);
The GROUP_ID function will return 0, for each unique group in the result set. It will return a value greater than 0, if a duplicated group is found.