>cursor cur_cp_cx is select tz_id from CP_JBXX where tz_id like '%'+p_cpnm+'%';
改为
cursor cur_cp_cx is select tz_id from CP_JBXX where tz_id like '%'||p_cpnm||'%';

解决方案 »

  1.   

    create or replace procedure sp_cp_mhcx

      p_cpnm in varchar2
    )
    is
      v_cpisn number(10);
      v_tzid varchar2(20);
      v_cpnm varchar2(40);
      v_cpjdid varchar2(10);
      cursor cur_cp_cx is select tz_id from CP_JBXX where tz_id like '%' || p_cpnm || '%';
    begin
        open cur_cp_cx;
        while cur_cp_cx %found loop
          fetch cur_cp_cx into v_tzid;
           select max(cpjd_id) into v_cpjdid from CP_JBXX where tz_id=v_tzid;
           select cp_isn,cp_nm into v_cpisn,v_cpnm from CP_JBXX where cpjd_id=v_cpjdid and tz_id=v_tzid;
         insert into TP_CP_CX(cp_isn,tz_id,cp_nm,cpjd_id) values (v_cpisn,v_tzid,v_cpnm,v_cpjdid);
       end loop;
      close cur_cp_cx;
      commit;
    end sp_cp_mhcx;
      

  2.   

    我该了以后,编译还是有错!而且不报什么错误。请问在oralce中如何调试存储过程??
      

  3.   

    ||在oracle中表示连接吗?
    ----
      

  4.   

    我将数据插入临时表TP_CP_CX,它是事务型,commit;是否会自动删除数据?
      

  5.   

    我编译成功了!谢谢
    我想通过模糊查询把准确的产品的图号tzid取出,然后再把该产品图号的最大阶段号取出cpjd_id ,接着取出产品名称和产品内码,最后插入临时表TP_CP_CX,它是事务型。然后想在pb前台数据窗口retrieve()显示.但是没有成功??是什么原因
      

  6.   

    我想通过模糊查询把准确的产品的图号tzid取出,然后再把该产品图号的最大阶段号取出cpjd_id ,接着取出产品名称和产品内码,最后插入临时表TP_CP_CX,它是事务型。然后想在pb前台数据窗口retrieve()显示.但是没有成功??是什么原因??