select * from tab_dc t where begintime > to_date('2011-8-22 8:00:00','yyyy-mm-dd hh24:mi:ss') and begintime < to_date('2011-8-22 12:30:00','yyyy-mm-hh hh24:mi:ss') 执行显示ora-01813:只能指定一次小时 不明白那里错了,求正确解答!
最后一个yyyy-mm-hh写错了,应该为yyyy-mm-dd。 还有最好写成: select * from tab_dc t where begintime between to_date('2011-8-22 8:00:00','yyyy-mm-dd hh24:mi:ss') and to_date('2011-8-22 12:30:00','yyyy-mm-hh hh24:mi:ss')
正确的语句是: select * from tab_dc t where begintime > to_date('2011-8-22 8:00:00','yyyy-mm-dd hh24:mi:ss') and begintime < to_date('2011-8-22 12:30:00','yyyy-mm-dd hh24:mi:ss')本回答被提问者采纳