oracle格式代码出现两次,文字与格式字符串不匹配

来源:互联网 发布:mac os qq 远程协助 编辑:程序博客网 时间:2024/05/16 09:20

不报错: 

 select count(*) as col_0_0_
          from scott.kk_sap_main kksapmain0_
         where to_date(kksapmain0_.fd_time, 'yyyy-MM-dd HH:mm:ss') >=
             '2013-07-09 00:00:00'
           and (to_date(kksapmain0_.fd_time, 'yyyy-MM-dd HH:mm:ss') >=
             '2013-07-24 23:59:59')

报文字与格式字符串不匹配:

  select count(*) as col_0_0_
          from scott.kk_sap_main kksapmain0_
         where to_date(kksapmain0_.fd_time, 'yyyy-MM-dd HH:mm:ss') >=
             '2013-07-09 00:00:00'
           and (to_date(kksapmain0_.fd_time, 'yyyy-MM-dd HH:mm:ss') <=
               '2013-07-24 23:59:59')

报格式代码出现两次:

select count(*) as col_0_0_
  from scott.kk_borrow_main kkborrowma0_
 where kkborrowma0_.doc_status <> '10'
   and to_date(kkborrowma0_.doc_create_time, 'yyyy-MM-dd HH:mm:ss') >=
       to_date('2013-07-05 17:24:00', 'yyyy-MM-dd HH:mm:ss')
   and to_date(kkborrowma0_.doc_create_time, 'yyyy-MM-dd HH:mm:ss') >=
       to_date('2013-07-31 17:24:59', 'yyyy-MM-dd HH:mm:ss')

正确方法:

  select count(*) as col_0_0_
          from scott.kk_sap_main kksapmain0_
         where to_date(kksapmain0_.fd_time, 'yyyy-MM-dd HH:mm:ss') >=
             '2013-07-09 00:00:00'
           and kksapmain0_.fd_time <= '2013-07-24 23:59:59'

原创粉丝点击