select a.time,a.node_id,count(node_id) as times from temperature a ,设备管理表 b where a.NODE_ID = b.注册标签号
and a.time between to_date('2010-09-27 00:00:00','yyyy-MM-dd hh24:mi:ss') and 
               to_date('2010-09-27 23:59:59','yyyy-mm-dd hh24:mi:ss')group by a.time,a.node_id加上时间查询条件便出错了以下是错误信息:
Error report:
SQL Error: ORA-01861: literal does not match format string
01861. 00000 -  "literal does not match format string"
*Cause:    Literals in the input must be the same length as literals in
           the format string (with the exception of leading whitespace).  If the
           "FX" modifier has been toggled on, the literal must match exactly,
           with no extra whitespace.
*Action:   Correct the format string to match the literal.

解决方案 »

  1.   

    count(node_id)没有指明属于哪个表
      

  2.   

    楼主检查下a.time这个栏位是不是date类型, 可能是放的时间值, 但是类型为varchar2
      

  3.   


    Error starting at line 1 in command:
    select a.time,a.node_id,count(a.node_id) as times from temperature a ,设备管理表 b where a.NODE_ID = b.注册标签号
    and a.time between to_date('2010-09-27 00:00:00','yyyy-MM-dd hh24:mi:ss') and 
                   to_date('2010-09-27 23:59:59','yyyy-MM-dd hh24:mi:ss')group by a.time,a.node_id
    Error report:
    SQL Error: ORA-01861: literal does not match format string
    01861. 00000 -  "literal does not match format string"
    *Cause:    Literals in the input must be the same length as literals in
               the format string (with the exception of leading whitespace).  If the
               "FX" modifier has been toggled on, the literal must match exactly,
               with no extra whitespace.
    *Action:   Correct the format string to match the literal.改成 count(a.node_id) 出同样错误。
      

  4.   

    楼主检查下a.time这个栏位是不是date类型, 可能是放的时间值, 但是类型为varchar2?
      

  5.   

    tx2730 说得没错 是varchar2 类型 
    看来出错在此处了 是别人建的表 搞不懂'2010-09-27 23:59:59' 格式 为什么要用varchar2类型?
      

  6.   

    ---count没有指定具体的列
    select a.time,a.node_id,count(a.node_id) as times from temperature a ,设备管理表 b where a.NODE_ID = b.注册标签号
    and a.time between to_date('2010-09-27 00:00:00','yyyy-MM-dd hh24:mi:ss') and  
      to_date('2010-09-27 23:59:59','yyyy-mm-dd hh24:mi:ss')group by a.time,a.node_id
      

  7.   

    这句SQL 是木有错误的,如果是你所說的加上时间查询条件便出错那就是你表里面的时间格式不是'yyyy-MM-dd hh24:mi:ss'