日期:2014-05-17 浏览次数:21376 次
WITH tmp AS ( --SELECT NULL a_date, SYSDATE b_date, SYSDATE + 1 c_date FROM dual SELECT NULL a_date, NULL b_date, NULL c_date FROM dual ) SELECT CASE WHEN greatest( nvl(a_date,to_date('00010101 00:00:00','YYYYMMDD HH24:MI:SS')) ,nvl(b_date,to_date('00010101 00:00:00','YYYYMMDD HH24:MI:SS')) ,nvl(c_date,to_date('00010101 00:00:00','YYYYMMDD HH24:MI:SS')) ) = to_date('00010101 00:00:00','YYYYMMDD HH24:MI:SS') THEN NULL ELSE greatest( nvl(a_date,to_date('00010101 00:00:00','YYYYMMDD HH24:MI:SS')) ,nvl(b_date,to_date('00010101 00:00:00','YYYYMMDD HH24:MI:SS')) ,nvl(c_date,to_date('00010101 00:00:00','YYYYMMDD HH24:MI:SS')) ) END FROM tmp