尝试使用ODP.NET
执行包存储过程调用失败并显示消息“ORA-00942:表或视图不存在\ nORA-06512:at \”SAAP.PKGPRICEWORX \“,第25行\ nORA-06512:....
但是,通过服务器服务器资源管理器运行时,该过程正常工作!
我在VS2010上使用ODP.net4程序集;
任何有助于解决此问题的帮助。
这是包裹:
clear;
/
create or replace
PACKAGE pkgPriceWorx
AS
defaultQANP NUMBER:=99999999;
procedure dbg(s varchar2,INDENT NUMBER DEFAULT 0,APPEND NUMBER DEFAULT 0);
FUNCTION frSls031CunoCpgsStdt( comno VARCHAR2,cuno VARCHAR2,cpgs VARCHAR2,stdt DATE,found OUT NUMBER)RETURN baan.ttdsls031010%rowtype ;
FUNCTION frSLS034( comno VARCHAR2, cuno VARCHAR2, cpgs VARCHAR2, found OUT NUMBER) RETURN baan.ttdsls034010%rowtype;
PROCEDURE prUpdateOrInsertDiscount( COMNO VARCHAR2 , CPLS VARCHAR2, CUNO VARCHAR2 , CPGS VARCHAR2, stdt DATE , DISC IN OUT NUMBER, O OUT VARCHAR2);
PROCEDURE prUpdateSLS031(R2U baan.ttdsls031010%rowtype,Comno varchar2, RowsUpdated out number);
PROCEDURE prUpdateOrInsertSLS034( comno VARCHAR2, cuno VARCHAR2, cpgs VARCHAR2, rowCount OUT NUMBER) ;
FUNCTION fnDefaultQANP RETURN NUMBER ;
procedure testNumPrecision(precie number);
END ;
/
show error;
/
create or replace
PACKAGE BODY pkgPriceWorx IS
spc varchar2(1):=' ';
jed varchar2(10):='1,J';-- Julian Expiry format
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
procedure dbg(s varchar2,INDENT NUMBER DEFAULT 0,APPEND NUMBER DEFAULT 0) as
BEGIN
if append =0 then
BEGIN
DBMS_output.Put_line(s);
END;
else
BEGIN
dbms_output.Put(s);
end;
End if;
END;
-------------------------------------------------------------------------------------
procedure prInsertSLS031(comno varchar2,cuno varchar2,cpgs varchar2,stdt Date,disc number, rowCount out number) as
sQ varchar2(3000);
BEGIN
dbms_output.put_line('@prInsertSLS031');
sQ:= ' Insert into baan.ttdsls031' ||comno|| '(t$cuno,t$cpgs,t$dile,t$qanp ,t$stdt ,t$tdat ,t$disc ,t$damt,t$cdis,t$gnpr,t$refcntd,t$refcntu)' || ' values( :cuno,:cpgs ,1 ,:qanp ,:stdt ,to_date('||'''1' || ''' ,'||'''J '''||') ,:disc ,0 ,' || ''' '''||' ,1 ,0 ,0)';
dbms_output.put_line(sQ);
EXECUTE immediate sQ USING cuno,cpgs,defaultqanp,STDT,disc;
rowCount:=sql%rowcount;
END;
-----------------------------------------------------------------------------------
PROCEDURE prUpdateOrInsertDiscount(COMNO VARCHAR2 ,CPLS VARCHAR2, CUNO VARCHAR2 , CPGS VARCHAR2 , stdt date, DISC in out NUMBER ,O out varchar2) AS
R31 BAAN.TTDSLS031010%ROWTYPE;
R34 BAAN.TTDSLS034010%ROWTYPE;
rowCount number;
sQ varchar2(3000);
rc number;
edt date;
iRC number;
uRc number;
BEGIN
/*------------------------------------------------------------------
1). Check SLS031.DISC(Customer and priceGroup, ?OPEN)
1.1) If a match found
1.2.1) Compare NewDiscount == current
return :
1.2.2) NewDisc != CURRENT
I . Update current to expire
II. Insert an entry
2.1) If No match found
I . insert new 31 entry
IDX1=CUNO,CPGS,DILE
?open=tdat=4712-01-01;
----------------------------------------------------------------*/
DBG('@prUpdateOrInsertDiscount');
R31:=frSLS031CunoCpgsStdt(COMNO,cuno,cpgs,stdt,rowCount );
DBMS_OUTPUT.PUT_LINE('ROW COUNT ON FRSLS031='|| ROWCOUNT);
IF (rowCount > 0) then -- 1.1 Match found
BEGIN
dbg('Match found');
if((stdt ) > R31.T$STDT Or (disc != R31.t$disc)) then
Begin
dbg('Ok : OpenRecord has stdt > (stdt-1)');
r31.t$tdat:=stdt-1;
prUpdateSLS031(R31,comno,uRc);
dbg('Updated rowCount ='||urc);
prInsertSLS031(comno,cuno,cpgs,stdt,disc, rowCount);
return;
End;
end if;
dbg('Both stdt and disc has no change.. nothing was done');
END;
ELSE -- NO NMATCH
Begin
dbg( ' No Match inserting new ' );
prInsertSLS031(comno,cuno,cpgs,stdt,disc,rowCount);
End;
END IF;
END prUpdateOrInsertDiscount;
----------------------------------------------------------------------------------
PROCEDURE prUpdateOrInsertSLS034(comno varchar2,cuno varchar2, cpgs varchar2,rowCount out number) AS
R baan.ttdsls034010%rowtype;
sQ varchar2(3000);
rc number;
cpls varchar2(3);
cuni varchar2(3);
BEGIN
R:=frSls034(comno,cuno,cpgs,rc);
if (rc > 0 ) then return; end if;
cpls :=' ';
cuni :='ea';
-- sQ:='insert into baan.ttdsls034' ||comno|| '(t$cuno,t$cpgs ,t$dile,t$APYN,T$CPLS,T$STSA,T$STSB,T$STSC,T$KOGR,T$CUNI,T$DMTH,T$REFCNTD,T$REFCNTU)' ;
-- ' VALUES(:CUNO ,:CPGS ,1 ,2 ,:CPLS ,2 ,2 ,2 ,1 , :CUNI ,1 ,0 ,0)';
dbms_output.put_line(sQ);
execute immediate sQ using cuno,cpgs,cpls,cuni;
END prUpdateOrInsertSLS034;
-----------------------------------------------------------------------------------
function fnDefaultQANP return number is n number;
Begin
return defaultQANP;
End;
-----------------------------------------------------------------------------------
function frSls031CunoCpgsStdt(comno varchar2,cuno varchar2,cpgs varchar2,stdt date,found out number) return baan.ttdsls031010%rowtype is
r baan.ttdsls031010%rowtype;
sQ varchar2(600);
BEGIN
sQ :='SELECT * FROM BAAN.TTDSLS031'||COMNO || ' WHERE ' ||
' TRIM(T$CUNO)=trim( :CUNO) AND ' || ' TRIM(T$CPGS)=trim( :CPGS) AND ' ||
' T$QANP = :qanp AND ' ||
' t$tdat =(select MIN(t$tdat) from baan.ttdsls031'||comno||' where trim(t$cuno)=trim(:cuno) ' ||
' and trim(t$cpgs)=trim(:cpgs) and t$qanp=:qanp) ';
execute immediate sQ into r using cuno,cpgs,fndefaultQanp,cuno,cpgs,fndefaultQanp;
found:=sql%rowcount;
RETURN R;
exception
when
no_data_found then found:=-1;
return null;
end;
-------------------------------------------------------------
function frSLS034(comno varchar2,cuno varchar2,cpgs varchar2,found out number) return baan.ttdsls034010%rowtype is
r baan.ttdsls034010%rowtype;
sQ varchar2(3000);
BEGIN
sQ :='SELECT * FROM BAAN.TTDSLS034'||COMNO || ' WHERE' || ' TRIM(T$CUNO)= trim(:CUNO) AND ' || ' TRIM(T$CPGS)=trim( :CPGS)';
EXECUTE immediate sQ INTO r USING cuno,cpgs;
FOUND:=SQL%ROWCOUNT;
RETURN R;
EXCEPTION
WHEN no_data_found THEN
found:=-1;
return null;
END;
----
PROCEDURE prUpdateSLS031(R2U baan.ttdsls031010%rowtype,Comno varchar2,RowsUpdated out number) as
sQ varchar2(3000);
Begin
sQ:='update baan.ttdsls031'||comno|| ' set t$tdat=:rtdat where t$cuno=:cuno and t$cpgs=:cpgs and t$dile=:dile and t$qanp=:qanp and t$stdt = :stdt ';
dbg( '@prUpdateSLS031');
dbg(' '||sQ);
execute immediate SQ using R2U.t$tdat , R2U.t$cuno , R2U.t$cpgs , R2U.t$dile , R2U.t$qanp , R2U.t$stdt;
RowsUpdated:=Sql%rowCount;
End ;
----
procedure testNumPrecision(precie number)as
Begin
null;
end;
-------------------------------------------------------------
-------------------------------------------------------------
END pkgPriceWorx;
/
show error;
/
答案 0 :(得分:1)
很抱歉打扰你的人,感谢Justin Cave暗示哪里可能是错误,这是网络代码中的一个错误,我在参数名称中删了一个字符,所以当动态sql构建时代码,它没有找到指定的参数(这是其中一个表的后缀)。