create or replace procedure getCollectionListByCondition
(
startTime date,
endTime date
)
str_sql :=str_sql || ' and lastTime between'||startTime||'and'||endTime||';
我在这里面谢了一句动态sql语句,现在运行时报错误:PLS-00103: 出现符号 ";

解决方案 »

  1.   

    --注意空格
    str_sql :=str_sql || ' and lastTime between '||startTime||' and '||endTime||';
      

  2.   


    str_sql :=str_sql || ' and lastTime between  '||startTime||'  and  '||endTime||';
      

  3.   

    在oracle数据中 把2010-01-02 03:40:12转换成 2010-01-02这种格式的函数和方法有没有
      

  4.   

    to_char(to_date('2010-01-02 03:40:12','yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd')
      

  5.   

    SQL> edi
    已写入 file afiedt.buf  1  select to_date('2010-01-02 03:40:12','yyyy-mm-dd hh24:mi:ss'),
      2  to_char(to_date('2010-01-02 03:40:12','yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd'),
      3* trunc(to_date('2010-01-02 03:40:12','yyyy-mm-dd hh24:mi:ss'),'dd') from dual
    SQL> /TO_DATE('2010- TO_CHAR(TO TRUNC(TO_DATE(
    -------------- ---------- --------------
    02-1月 -10     2010-01-02 02-1月 -10
      

  6.   

    str_sql :=str_sql || ' and lastTime between'||startTime||'and'||endTime||'; 单引号不配对,少了个
      

  7.   

    问题多着呢  
      过程后面 as 没写  begin没写   str_sql 没定义
    动态sql都没拼好
      

  8.   

    create or replace procedure getCollectionListByCondition
    (
    startTime date,
    endTime date
    ) as
    str_sql varchar2(200);
    begin
    str_sql:='str_sql and lastTime between'|| startTime||'and'|| endTime||'';
    end;