select GREATEST(TRUNC(MAX(NVL(need_by_date,promised_date))),TRUNC(MAX(NVL(promised_date,need_by_date)))) from po_line_locations_all

this query gives the need_by_date (or) promised_date (which ever...