open qyrow for 'select bj,bsh,cch,csh,hy from kf_yjdj
where qkmch=:1 and jh=:2 and to_char(rkrq,''yyyy-mm-dd'')=:3'
using qkmch1,jh1,rkrq1 ;

解决方案 »

  1.   

    计算失败,原因:ORA-00932: 不一致的数据类型: 要求 DATE 得到的却是 NUMBER ORA-06512: 在"CYKF.PR_KF_YJYK_QYCL1", line 36 ORA-06512: 在"CYKF.PR_KF_YJYK", line 72 ORA-06512: 在line 1
      

  2.   

    SQL> begin
      2  dbms_output.put_line('select bj,bsh,cch,csh,hy from kf_yjdj where qkmch=:1 and jh=:2 and to_char(rkrq,''yyyy-mm-dd'')=:3 ');
      3  end;
      4  /select bj,bsh,cch,csh,hy from kf_yjdj where qkmch=:1 and jh=:2 and to_char(rkrq,'yyyy-mm-dd')=:3 PL/SQL procedure successfully completed楼主检查一下语句执行的时候是不是有什么地方类型不匹配
      

  3.   

    open qyrow for 'select bj,bsh,cch,csh,hy from kf_yjdj 
    where qkmch=:1 and jh=:2 and to_char(rkrq,'''yyyy-mm-dd''')=:3'
    using qkmch1,jh1,rkrq1 ;
      

  4.   

    sorry!
    更正一下:
    open qyrow for 'select bj,bsh,cch,csh,hy from kf_yjdj 
    where qkmch=:1 and jh=:2 and to_char(rkrq,''yyyy-mm-dd'')=:3'
    using qkmch1,jh1,rkrq1 ;  
      

  5.   

    简单的方法: 用 || 连. 不过大多数情况下, 是用bind parameter性能高
      

  6.   

    create or replace procedure abcd(psbj1 out kf_yjdj.bj%type) as
    type row_sql is ref cursor;
    row  row_sql;
    tab kf_yjdj%rowtype;
    psbj kf_yjdj.bj%type;
    begin
    open row for 'select bj from kf_yjdj ';
       loop
           fetch row into tab;
           exit when row%notfound;
           psbj:=tab.bj;
       end loop;
       close row;
    psbj1:=psbj;
    end;
    为什么出这个错啊,,
    在这行提示  fetch row into tab;   真晕,,,,,