改一下
Cursor c_nsrsbh is select distinct nsrsbh from v_pjdebz where bz = v_pjdexm;

解决方案 »

  1.   

    我在SQLPLAS下就创建不了,open c_nsrsbh;
    ORA-00922: 缺少或无效选项
    fetch c_nsrsbh into v_nsrsbh;
    ORA-00900: 无效 SQL 语句
      

  2.   

    不知你是不是想这样:
    Create Or Replace procedure get_pjde(v_pjdexm in varchar2) is 
        Cursor c_nsrsbh is 
         select distinct nsrsbh 
          from v_pjdebz 
           where bz = v_pjdexm;         --定义光标
        v_nsrsbh varchar2(20);       --纳税人识别号
        n_pjde   number(14,2);       --平均定额
        i        number:=0;          --标志
        n_hdse   number(14,2);       --核定税额
        n_sumse  number(14,2):=0;    --税额合计
    --根据v_pjdexm取出纳税人识别号并计算总税额
    begin
      --打开c_nsrsbh光标
        open c_nsrsbh;
        --根据纳税人识别号取出核定税额         
        loop 
          fetch c_nsrsbh into v_nsrsbh;
          exit when c_nsrsbh%NOTFOUND;
          select nvl(hyse,0) into n_hdse 
           from de_hd
            where nsrsbh = v_nsrsbh.nsrsbh;
          i := i + 1;
          n_sumse := n_sumse + n_hdse;
        end loop;
       --计算平均定额
          n_pjde := n_sumse/i;
      --插入dj_pjde表记录
          insert into dj_pjde(pjdexm,pjde) 
           values(v_pjdexh,n_pjde);
    exception
      when others then
          Raise_Application_Error(-20100,'Error:执行过过程:get_pjde(平均定额过程)发生错误!!!'||sqlerrm);
          return;
    end get_pjde;