Greatest not null column Greatest not null column oracle oracle

Greatest not null column


COALESCE(GREATEST(date_one, date_two), date_one, date_two)


My solution for multiple columns is:

SELECT NULLIF(  GREATEST(    NVL(NULL,     to_date('01011980','ddmmyyyy')), --COLUMN 1    NVL(sysdate,  to_date('01011980','ddmmyyyy')), --COLUMN 2    NVL(NULL,     to_date('01011980','ddmmyyyy')), --COLUMN 3    NVL(sysdate-1,to_date('01011980','ddmmyyyy'))  --COLUMN 4  ),to_date('01011980','ddmmyyyy')) as greatest_dateFROM DUAL;