Oracle数据库拼字符串是用"||"连接的。在开发中,经常会用到时间范围的查询 例如 startTime >='2017-05-22 00:00:00' and endTime <='2017-05-22 23:59:59'
SELECT to_date(to_char(sysdate - 1, 'YYYY-MM-DD') || ' 00:00:00', 'YYYY-MM-DD hh24:mi:ss') as "START_TIME" from dual;
结果:
START_TIME
--------------------------
2017-05-21 00:00:00
SELECT to_date(to_char(sysdate - 1, 'YYYY-MM-DD') || ' 23:59:59', 'YYYY-MM-DD hh24:mi:ss') as "END_TIME" from dual;
结果:
END_TIME
--------------------------
2017-05-21 23:59:59