Home >Database >Mysql Tutorial >Oracle中日期转换报“输入值对于日期格式长度不够”

Oracle中日期转换报“输入值对于日期格式长度不够”

WBOY
WBOYOriginal
2016-06-07 17:30:494150browse

Oracle中日期转换报输入值对于日期格式长度不够

Oracle中日期转换报"输入值对于日期格式长度不够"

select (select j.jgmc from t_zzjg j where j.jgdm = t.jgdm) jgmc,
      t.jgdm,
      sum(t.jcj) jcj,
      sum(t.sa) sa,
      sum(t.la) la,
      sum(t.ajbl) ajbl,
      sum(t.xsqzcs) xsqzcs,
      sum(t.sacw) sacw,
      sum(t.jgzx) jgzx,
      sum(t.zfgz) zfgz,
      sum(t.jjclaj) jjclaj,
      sum(t.zs) zs
  from t_fxyp_zfycfbtj t
 where t.rq between to_date(2013 - 01 - 18  , 'YYYY-MM-DD') and
      to_date(2013 - 07 - 18    , 'YYYY-MM-DD')
  and exists (select z.jgdm
          from t_zzjg z
        where (z.dwlx = 'SJ' or z.sjjgdm is null)
          and z.jgdm = t.jgdm)
 group by t.jgdm
 order by t.jgdm

正确语句

select to_date('2012-05-06 12:05:03','yyyy-mm-dd hh24:mi:ss') from dual

select to_date('2012-05-06','yyyy-mm-dd hh24:mi:ss') from dual

select to_date('2012-05-06','yyyy-mm-dd') from dual

该查询语句导致该原因是因为在to_date()这个方法里面,前面输入的日期要加上单引号.

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn