ORA-01830: date format picture ends before converting entire

sql语句如下:

select        cph
         from   w_chls_hsb_view
       where
      rq_option_b>=to_date('2007/09/16 00:00:00','yyyy.mm.dd') AND rq_option_b<=to_date('2007/09/16 00:00:00','yyyy.mm.dd')

官方文档的回答如下:

Cause: A valid date format picture included extra data. The first part of the format picture was converted into a valid date, but the remaining data was not required.

Action: Check the specifications for date format pictures and correct the statement.

也就是说:

to_date函数的日期部分是一个合法的日期格式,但是包含额外的数据,这部分额外的数据是不需要的。

改成下面的就可以了(把时间去掉):

select        cph
         from   w_chls_hsb_view
       where
      rq_option_b>=to_date('2007/09/16','yyyy.mm.dd') AND rq_option_b<=to_date('2007/09/16','yyyy.mm.dd')

 

你可能感兴趣的:(sql)