oracle 判断条件不在某一时间范围内(not between)

判断条件在某一段时间范围内用 BETWEEN

SELECT *
FROM P_VOTE t
WHERE to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') BETWEEN to_char(t.BEGIN_TIME, 'yyyy-mm-dd hh24:mi:ss') AND to_char(t.END_TIME, 'yyyy-mm-dd hh24:mi:ss')

判断条件不在某一时间段范围内 使用NOT BETWEEN

SELECT *
FROM P_VOTE t
WHERE to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') NOT BETWEEN to_char(t.BEGIN_TIME, 'yyyy-mm-dd hh24:mi:ss') AND to_char(t.END_TIME, 'yyyy-mm-dd hh24:mi:ss')

 

 

你可能感兴趣的:(oracle)