我的存储过程中有这样一段:
v_query := 'select * from currhours where  EPCB_CHR_SUMTIME>to_date('2005-07-01','YYYY-MM-DD') and CHR_SUMTIME<to_date('2005-07-03','YYYY-MM-DD') '
        
open Cables_Return for lv_query;编译存储过程报错:Compilation errors for PACKAGE BODY YH_SCJK.PG_TRSCABLEError: PLS-00103: Encountered the symbol "2005" when expecting one of the following:
       
          . ( * @ % & = - + ; < / > at in is mod not rem
          <an exponent (**)> <> or != or ~= >= <= <> and or like
          between ||
       The symbol "(" was substituted for "2005" to continue.
Line: 11
我知道可能是to_date函数里的单引号有问题,可是该怎么改呢?请各位指点!

解决方案 »

  1.   

    v_query := 'select * from currhours where  EPCB_CHR_SUMTIME>to_date(''2005-07-01'',''YYYY-MM-DD'') and CHR_SUMTIME<to_date(''2005-07-03'',''YYYY-MM-DD'') '
            
      

  2.   

    To njhart2003:
    照你的改了,还是报错啊!!Compilation errors for PACKAGE BODY YH_SCJK.PG_TRSCABLE
    Error: PLS-00103: Encountered the symbol "OPEN" when expecting one of the following:
           
              . ( * @ % & = - + ; < / > at in is mod not rem
              <an exponent (**)> <> or != or ~= >= <= <> and or like
              between ||
    Line: 14
    Text: open Cables_Return for lv_query;
      

  3.   

    少了个“;”
    v_query := 'select * from currhours where  EPCB_CHR_SUMTIME>to_date(''2005-07-01'',''YYYY-MM-DD'') and CHR_SUMTIME<to_date(''2005-07-03'',''YYYY-MM-DD'') ';
      

  4.   

    晕,后面我有一段给注释了,把分号也给……
    结了!多谢 njhart2003!!