1. 程式人生 > >oracle格式程式碼出現兩次,文字與格式字串不匹配

oracle格式程式碼出現兩次,文字與格式字串不匹配

不報錯: 

 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'