Search notes:

Oracle SQL: using the LAG analytic clause to show values only when they change

The LAG analytic clause can be used to show values only when they have changed with respect to the prior record.
SELECT
   case when nvl(
      LAG( COLUMN_NAME ) over (order by  COLUMN_NAME, further, sorting, columns ),
      'n/a'
   ) <> COLUMN_NAME then
        COLUMN_NAME
   end                       COLUMN_NAME_
   …
FROM
   …
ORDER BY
   COLUMN_NAME,
   further,
   sorting,
   columns

Index