L
lytwyx
Unregistered / Unconfirmed
GUEST, unregistred user!
delphi调用代码如下:<br> pro_mc := ADOQuery1.FieldValues['procedure'];<br> ADOStoredProc1.ProcedureName := 'dbo.'+pro_mc;<br> ADostoredProc1.Parameters.Clear;<br> with ADostoredProc1.Parameters.AddParameter do<br> begin<br><br> DataType :=ftString;<br> Direction := pdInput;<br> Value := pro_id;<br> end;<br> with ADostoredProc1.Parameters.AddParameter do<br> begin<br> DataType :=ftString;<br> Direction := pdInput;<br> Value := jq;<br> end;<br> with ADostoredProc1.Parameters.AddParameter do<br> begin<br> DataType :=ftString;<br> Direction := pdInput;<br> Value := bq;<br> end;<br> with ADostoredProc1.Parameters.AddParameter do<br> begin<br> DataType :=ftString;<br> Direction := pdInput;<br> Value := swjg_dm;<br> end;<br> with ADostoredProc1.Parameters.AddParameter do<br> begin<br> DataType :=ftString;<br> Direction := pdInput;<br> Value := gydm;<br> end;<br> with ADostoredProc1.Parameters.AddParameter do<br> begin<br> DataType :=ftString;<br> Direction := pdInput;<br> Value := zsxmdm;<br> end;<br> with ADostoredProc1.Parameters.AddParameter do<br> begin<br> DataType :=ftString;<br> Direction := pdInput;<br> Value := djzclxdm;<br> end;<br> //ADostoredProc1.Open;<br> ADostoredProc1.Prepared;<br> ADostoredProc1.ExeExecProc;<br>函数内容如下函数在pl/sql中测试通过)<br><br>create or replace function pro_yyhy_zyywsrbdl(zbid in string,jq in string, bq in string,swjgdm in string,zggy in string,zsxm in string,djzclx in string) return number is<br> Result number;<br> CURSOR nsrfw (curswjgdm string,curzggydm string,curzsxm string,curdjzclx string) is --确定纳税人范围<br> select distinct(a.nsrsbh) from dj_nsrxx a,dj_sz b <br> where a.nsr_swjg_dm like trim(curswjgdm) and a.zg_swgy_dm like trim(curzggydm) and<br> a.nsrsbh=b.nsrsbh and b.zsxm_dm like trim(curzsxm) and a.nsr_swjg_dm=b.nsr_swjg_dm and <br> a.djzclx_dm like trim(curdjzclx) and (a.nsrmc like '%医药%' or a.hy_dm='2700') and a.nsrzt_dm in<br> ('10','21','22','23','71');<br> /*<br> 目前纳税人的范围还没有确定<br> */<br> --CURSOR nsrfw is --确定纳税人范围<br> --select nsrsbh from dj_nsrxx where nsrsbh='620103756556236';<br> nsrsbh VARCHAR2(20); --纳税人识别号<br> jqnd char(4); --基期年<br> jqyq char(10); --基期起<br> jqyz char(8); --基期止<br> jqsr number; --基期收入<br> jqljsr number; --基期累计收入<br> bqnd char(4); --本期年<br> bqyq char(8); --本期起<br> bqyz char(8); --本期止<br> bqsr number; --本期收入<br> bqljsr number; --本期累计收入<br> pzxh CHAR(16); --sb_zzs_2003_fb.pzxh<br> bz number(4,2); --基期本期比值<br> pgjgxh char(8); --评估结果id<br> pgsj date; --评估时间 <br> tablejq char(9);<br> tablebq char(9);<br> cszggy char(11);<br> cszsxm char(2);<br> csdjzclx char(2);<br> inswjgdm char(11);<br> CURSOR jqsrpzxh(curjqyq string,curjqyz string,curnsrsbh string) is --确定基期收入pzxh<br> select pzxh from sb_zzs_2003_fb where fblx='FB6' and to_date(to_char(sssq_q,'yyyy-mm'),'yyyy-mm') between to_date(curjqyq,'yyyy-mm') and to_date(curjqyz,'yyyy-mm') and nsrsbh=curnsrsbh; <br> CURSOR bqsrpzxh (curbqyq string,curbqyz string,curnsrsbh string) is --确定基期收入pzxh<br> select pzxh from sb_zzs_2003_fb where fblx='FB6' and to_date(to_char(sssq_q,'yyyy-mm'),'yyyy-mm') between to_date(curbqyq,'yyyy-mm') and to_date(curbqyz,'yyyy-mm') and nsrsbh=curnsrsbh; <br> CURSOR jqsrls(curpzxh string) is --确定主营业务收入<br> select bys from sb_zzs_2003_fb6 where pzxh= curpzxh and fbxm_dm='6101'; <br>begin<br> --首先确定游标是否有记录<br> if zggy ='全部' then<br> cszggy := '%';<br> end if;<br> if zsxm ='全部' then<br> cszsxm := '%';<br> end if;<br> if djzclx='全部' then<br> csdjzclx := '%';<br> end if;<br> OPEN nsrfw(swjgdm,cszggy,cszsxm,csdjzclx);<br> FETCH nsrfw into nsrsbh;<br> IF (nsrfw%NOTFOUND) then<br> Result :=100; --没有发现符合范围的纳税人<br> ELSE<br> jqnd := trim(substr(jq,1,4));<br> jqyq := jqnd ||'-'|| trim(substr(jq,5,2));<br> jqyz := jqnd ||'-'|| trim(substr(jq,7,2));<br> bqnd := substr(bq,1,4);<br> bqyq := jqnd ||'-'|| trim(substr(bq,5,2));<br> bqyz := jqnd ||'-'|| trim(substr(bq,7,2));<br> --处理税务机关代码<br> if length(swjgdm)<11 then<br> inswjgdm:=substr(swjgdm,1,length(swjgdm)-1);<br> while not(length(inswjgdm)<11) loop<br> inswjgdm:= inswjgdm || '0';<br> end loop;<br> else<br> inswjgdm := swjgdm;<br> end if;<br> <br> select FBXH.NEXTVAL into pgjgxh from dual;<br> select sysdate into pgsj from dual; <br> insert into nspg_pgjg values(pgjgxh,zbid,jq,bq,inswjgdm,zggy,zsxm,djzclx,pgsj);<br> WHILE not(nsrfw%NOTFOUND) LOOP<br> jqsr := 0;<br> jqljsr := 0;<br> --提取基期的主营业务收入<br> OPEN jqsrpzxh(jqyq,jqyz,nsrsbh);<br> FETCH jqsrpzxh into pzxh;<br> if (jqsrpzxh%NOTFOUND) then<br> Result := 100;<br> ELSE<br> WHILE NOT(jqsrpzxh%NOTFOUND) LOOP<br> OPEN jqsrls(pzxh);<br> FETCH jqsrls into jqsr;<br> if (jqsrls%NOTFOUND) then<br> Result := 100;<br> ELSE<br> WHILE NOT(jqsrls%NOTFOUND) LOOP<br> jqljsr := jqljsr + jqsr;<br> FETCH jqsrls into jqsr;<br> END LOOP; <br> END IF;<br> CLOSE jqsrls;<br> FETCH jqsrpzxh into pzxh;<br> END LOOP; <br> END IF;<br> CLOSE jqsrpzxh;<br> --提取本期的主营业务收入<br> bqsr := 0;<br> bqljsr := 0; <br> OPEN bqsrpzxh(bqyq,bqyz,nsrsbh);<br> FETCH bqsrpzxh into pzxh;<br> if (bqsrpzxh%NOTFOUND) then<br> Result := 100;<br> ELSE<br> WHILE NOT(bqsrpzxh%NOTFOUND) LOOP<br> OPEN jqsrls(pzxh);<br> FETCH jqsrls into bqsr;<br> if (jqsrls%NOTFOUND) then<br> Result := 100;<br> ELSE<br> WHILE NOT(jqsrls%NOTFOUND) LOOP<br> bqljsr := bqljsr + bqsr;<br> FETCH jqsrls into bqsr;<br> END LOOP;<br> --计算基期和本期比值<br> if jqljsr=0 then<br> bz := 0;<br> else<br> bz := (bqljsr-jqljsr)/jqljsr;<br> end if;<br> --插入nspg_pgjg、nspg_pgjg_mx表中<br> --SET TRANSACTION READ WRITE;<br> insert into nspg_pgjg_mx values(pgjgxh,nsrsbh,bqljsr-jqljsr,bqljsr,bz);<br> <br> Result := 10;<br> END IF;<br> CLOSE jqsrls;<br> FETCH bqsrpzxh into pzxh;<br> END LOOP;<br> END IF; <br> CLOSE bqsrpzxh; <br> FETCH nsrfw into nsrsbh;<br> END LOOP;<br> commit;<br> CLOSE nsrfw; <br> END IF; <br> return(Result);<br>end pro_yyhy_zyywsrbdl;<br>/<br>错误提示:<br><br>Project project1.exe raised exception class EOLeEcception with message 'ORA-06550'<br>line 1 column 7:<br>PLS-00221 :'PRO_YYHY_ZYYWSRBDL' is not a procedure or is undefined<br>ORA_06550: line1 column7:<br>PL/SQL:statement ignored process stopped use step or run to continue