ORACLE 包调用出错ORA-06550: 第 1 行, 第 7 列
查询差旅费的,输入四个参数,输入一个结果集,用于我们的报表代码:SQLcodecreateorreplacepackageP_Rpt_Rate_Evectionistyp...
查询差旅费的,输入四个参数,输入一个结果集,用于我们的报表
代码:
SQL codecreate or replace package P_Rpt_Rate_Evection is
type cur is ref cursor;
procedure Rpt_Rate_Evection
(
StartDate in date,---开始日期
EndDate in date,---结束日期
DepartMent in varchar2,--部门名称
HandleMan in varchar2---报销人
);
end P_Rpt_Rate_Evection;
create or replace package body P_Rpt_Rate_Evection
is
procedure Rpt_Rate_Evection
(
StartDate in date,---开始日期
EndDate in date,---结束日期
DepartMent in varchar2,--部门名称
HandleMan in varchar2---报销人
)
is
-------------变量定义
mysql varchar2(30);
V_DEPARTMENT varchar(50); V_HANDLEMAN varchar(50); V_CARAMOUNT NUMBER; V_TRAINAMOUNT NUMBER; V_FLIGHTAMOUNT NUMBER;
V_MEETAMOUNT NUMBER;V_TAXIAMOUNT NUMBER;V_HOTELAMOUNT NUMBER; V_EDUCATEAMOUNT NUMBER;
V_SUBSIDYAMOUNT NUMBER; V_OTHERAMOUNT NUMBER;V_AMOUNT NUMBER ;
----------游标定义-------------
CURSOR cur is
(select D.NAME,DU.NAME, R.CARAMOUNT,R.TRAINAMOUNT,R.FLIGHTAMOUNT,R.MEETAMOUNT,R.TAXIAMOUNT, R.HOTELAMOUNT ,
R.EDUCATEAMOUNT,R.SUBSIDYAMOUNT, R.OTHERAMOUNT,R.AMOUNT
from rate_evection R ,d_organization D,d_user DU
where R.DEPARTMENT_XID=D.ID and R.HANDLEMAN_XID=DU.ID and D.NAME like DepartMent
and DU.NAME like HandleMan and to_char( R.CREATEDATE)<=to_char( EndDate) AND to_char( R.CREATEDATE)>=to_char(StartDate));
begin
-----创建临时表-------
mysql:='create GLOBAL TEMPORARY table temp ( DEPARTMENT varchar, HANDLEMAN varchar, CARAMOUNT NUMBER(15,2),
TRAINAMOUNT NUMBER(15,2), FLIGHTAMOUNT NUMBER(15,2), MEETAMOUNT NUMBER(10,2),TAXIAMOUNT NUMBER(15,2),
HOTELAMOUNT NUMBER(15,2), EDUCATEAMOUNT NUMBER(10,2), SUBSIDYAMOUNT NUMBER(10,2), OTHERAMOUNT NUMBER(10,2), AMOUNT NUMBER(15,2), )
on commit preserve rows ';
execute immediate mysql;
open cur;
loop
fetch cur into V_DEPARTMENT,V_HANDLEMAN,V_CARAMOUNT,V_TRAINAMOUNT, V_FLIGHTAMOUNT,V_MEETAMOUNT , V_TAXIAMOUNT,
V_HOTELAMOUNT, V_EDUCATEAMOUNT, V_SUBSIDYAMOUNT, V_OTHERAMOUNT, V_AMOUNT;
EXIT WHEN cur%NOTFOUND;
mysql:='INSERT INTO temp
values (V_DEPARTMENT,V_HANDLEMAN,V_CARAMOUNT,V_TRAINAMOUNT,V_FLIGHTAMOUNT,V_MEETAMOUNT ,V_TAXIAMOUNT,
V_HOTELAMOUNT,V_EDUCATEAMOUNT, V_SUBSIDYAMOUNT,V_OTHERAMOUNT,V_AMOUNT)';
execute immediate mysql;
end loop;
close cur;
commit;
mysql:=' select * from temp';
execute immediate mysql;
end;
end P_Rpt_Rate_Evection;
在CS客户端调用时报错
ORA-06550: 第 1 行, 第 7 列:
PLS-00306: 调用 'RPT_RATE_EVECTION' 时参数个数或类型错误
ORA-06550: 第 1 行, 第 7 列:
PL/SQL: Statement ignored
我是ORACLE新手,上面的包是仿照写的,以前没写过?是不是有什么定义不对的地方?编绎正确 展开
代码:
SQL codecreate or replace package P_Rpt_Rate_Evection is
type cur is ref cursor;
procedure Rpt_Rate_Evection
(
StartDate in date,---开始日期
EndDate in date,---结束日期
DepartMent in varchar2,--部门名称
HandleMan in varchar2---报销人
);
end P_Rpt_Rate_Evection;
create or replace package body P_Rpt_Rate_Evection
is
procedure Rpt_Rate_Evection
(
StartDate in date,---开始日期
EndDate in date,---结束日期
DepartMent in varchar2,--部门名称
HandleMan in varchar2---报销人
)
is
-------------变量定义
mysql varchar2(30);
V_DEPARTMENT varchar(50); V_HANDLEMAN varchar(50); V_CARAMOUNT NUMBER; V_TRAINAMOUNT NUMBER; V_FLIGHTAMOUNT NUMBER;
V_MEETAMOUNT NUMBER;V_TAXIAMOUNT NUMBER;V_HOTELAMOUNT NUMBER; V_EDUCATEAMOUNT NUMBER;
V_SUBSIDYAMOUNT NUMBER; V_OTHERAMOUNT NUMBER;V_AMOUNT NUMBER ;
----------游标定义-------------
CURSOR cur is
(select D.NAME,DU.NAME, R.CARAMOUNT,R.TRAINAMOUNT,R.FLIGHTAMOUNT,R.MEETAMOUNT,R.TAXIAMOUNT, R.HOTELAMOUNT ,
R.EDUCATEAMOUNT,R.SUBSIDYAMOUNT, R.OTHERAMOUNT,R.AMOUNT
from rate_evection R ,d_organization D,d_user DU
where R.DEPARTMENT_XID=D.ID and R.HANDLEMAN_XID=DU.ID and D.NAME like DepartMent
and DU.NAME like HandleMan and to_char( R.CREATEDATE)<=to_char( EndDate) AND to_char( R.CREATEDATE)>=to_char(StartDate));
begin
-----创建临时表-------
mysql:='create GLOBAL TEMPORARY table temp ( DEPARTMENT varchar, HANDLEMAN varchar, CARAMOUNT NUMBER(15,2),
TRAINAMOUNT NUMBER(15,2), FLIGHTAMOUNT NUMBER(15,2), MEETAMOUNT NUMBER(10,2),TAXIAMOUNT NUMBER(15,2),
HOTELAMOUNT NUMBER(15,2), EDUCATEAMOUNT NUMBER(10,2), SUBSIDYAMOUNT NUMBER(10,2), OTHERAMOUNT NUMBER(10,2), AMOUNT NUMBER(15,2), )
on commit preserve rows ';
execute immediate mysql;
open cur;
loop
fetch cur into V_DEPARTMENT,V_HANDLEMAN,V_CARAMOUNT,V_TRAINAMOUNT, V_FLIGHTAMOUNT,V_MEETAMOUNT , V_TAXIAMOUNT,
V_HOTELAMOUNT, V_EDUCATEAMOUNT, V_SUBSIDYAMOUNT, V_OTHERAMOUNT, V_AMOUNT;
EXIT WHEN cur%NOTFOUND;
mysql:='INSERT INTO temp
values (V_DEPARTMENT,V_HANDLEMAN,V_CARAMOUNT,V_TRAINAMOUNT,V_FLIGHTAMOUNT,V_MEETAMOUNT ,V_TAXIAMOUNT,
V_HOTELAMOUNT,V_EDUCATEAMOUNT, V_SUBSIDYAMOUNT,V_OTHERAMOUNT,V_AMOUNT)';
execute immediate mysql;
end loop;
close cur;
commit;
mysql:=' select * from temp';
execute immediate mysql;
end;
end P_Rpt_Rate_Evection;
在CS客户端调用时报错
ORA-06550: 第 1 行, 第 7 列:
PLS-00306: 调用 'RPT_RATE_EVECTION' 时参数个数或类型错误
ORA-06550: 第 1 行, 第 7 列:
PL/SQL: Statement ignored
我是ORACLE新手,上面的包是仿照写的,以前没写过?是不是有什么定义不对的地方?编绎正确 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询