日报,每天23:59:59秒执行一次,统计当日信息!
Selece * from table
where date>=to_date('2010-08-11 00:00:00','yyyy-mm-dd hh24:mi:ss')
and date<=to_date('2010-08-11 23:59:59','yyyy-mm-dd hh24:mi:ss')
每天的日期都不一样,怎么得到?
并且拼接成'2010-08-11 00:00:00'和'2010-08-11 23:59:59
Selece * from table
where date>=to_date('2010-08-11 00:00:00','yyyy-mm-dd hh24:mi:ss')
and date<=to_date('2010-08-11 23:59:59','yyyy-mm-dd hh24:mi:ss')
每天的日期都不一样,怎么得到?
并且拼接成'2010-08-11 00:00:00'和'2010-08-11 23:59:59
where date>=to_date(to_char(sysdate,'yyyy-mm-dd')+' 00:00:00','yyyy-mm-dd hh24:mi:ss')
and date<=to_date(to_char(sysdate,'yyyy-mm-dd')+' 23:59:59','yyyy-mm-dd hh24:mi:ss')
TRUNC(SYSDATE)
--------------
2010-8-11
SQL> select trunc(sysdate+1)-1/24/60/60 from dual;
TRUNC(SYSDATE+1)-1/24/60/60
---------------------------
2010-8-11 23:59:59
SQL>
'yyyy-mm-dd hh24:mi:ss'),
to_date(to_char(sysdate, 'yyyy-mm-dd') || ' 23:59:59',
'yyyy-mm-dd hh24:mi:ss')
from dual;