select count(*) from imms_realsend
       where vc2status='0'
        and to_char(datcreate, 'yyyymmdd')>= to_char('2007-7-18','yyyymmdd')
          and to_char(datcreate,'yyyymmdd')<=to_char('2008-8-18','yyyymmdd')高手們,我是菜鳥,請指教!
這條語句為什麽會報個無效數字?
把後面兩個and去掉就正常了。
如何解決?

解决方案 »

  1.   

    select to_char(ir.datcreate, 'yyyymmdd') ,
                 count(*)
                 from imms_realsend ir
                 where ir.vc2status='2'
                 and to_char(ir.datcreate, 'yyyymmdd')>= to_char('2007-7-18','yyyymmdd')
                 and to_char(ir.datcreate,'yyyymmdd')<=to_char('2008-8-18','yyyymmdd')
                 group by to_char(ir.datcreate, 'yyyymmdd');
    整體是這樣.
      

  2.   

      select to_char(ir.datcreate, 'yyyymmdd') ,
                 count(*)
                -- into v_datdeal,v_failsum
                 from imms_realsend ir
                 where 
                 trunc(ir.datcreate)>= to_date('2008-07-19','yyyy-mm-dd')
                 and trunc(ir.datcreate)<=to_date('2008-08-19','yyyy-mm-dd')
                 and ir.vc2status='2'
                 group by to_char(ir.datcreate, 'yyyymmdd');--失敗總筆數已解決,謝謝各位!