我在尝试从BIRT执行存储过程时遇到上述错误。请告诉我从BIRT调用存储过程的正确方法。我的SP在表中运行一系列命令和插入行。我首先调用SP并查询该表中的数据来构建报告。由于报告将导入Maximo,不确定我是否可以使用JDBC连接!
以下是我的程序:
CREATE OR REPLACE PROCEDURE MAXIMO.P_CCNBDET
(V_ACC VARCHAR2,
V_CYID VARCHAR2,
V_YMNTH VARCHAR2)
AS
V_CCSD date;
V_CCED date;
V_RUNDT date;
BEGIN
Delete from maximo.P_CCNBDET where accountnum = V_ACC and cycleid = V_CYID and billyearmonth = V_YMNTH;
COMMIT;
select startdate into V_CCSD from maximo.cyclemaster where cycleid = V_CYID and billyearmonth = V_YMNTH;
select enddate into V_CCED from maximo.cyclemaster where cycleid = V_CYID and billyearmonth = V_YMNTH;
select rundate into V_RUNDT from maximo.cyclemaster where cycleid = V_CYID and billyearmonth = V_YMNTH;
------- Install Begins------------------
DECLARE CURSOR c1 IS
select
0 as hasld,
'EN' as LANGCODE,
accountnum as accountnum,
itemnum as itemnum,
INVESTBY as INVESTBY,
sum(ct) as ct1
from
(
select
accountnum as accountnum ,
itemnum as itemnum,
INVESTBY as INVESTBY,
billstatus as billstatus ,
sum(((billenddate - billbegindate)/30)) as ct
from
maximo.sparepart where siteid = 'TD' and billstatus in ('I') and BILLENDDATE =V_CCED and accountnum = V_ACC
group by accountnum,itemnum,INVESTBY,billstatus
union all
select
accountnum as accountnum ,
itemnum as itemnum,
INVESTBY as INVESTBY,
billstatus as billstatus ,
sum(((billenddate - billbegindate)/30)) as ct
from
maximo.sparepart where siteid = 'TD' and billstatus in ('C') and BILLENDDATE >= V_CCSD and BILLENDDATE <= V_CCED and accountnum = V_ACC
group by accountnum,itemnum,INVESTBY,billstatus
union all
select
accountnum as accountnum ,
itemnum as itemnum,
INVESTBY as INVESTBY,
billstatus as billstatus ,
count(1) as ct
from maximo.sparepart where siteid = 'TD'
and billstatus in ('B') and BILLENDDATE is null and BILLBEGINDATE< V_CCED and accountnum = V_ACC
group by accountnum,itemnum,investby,billstatus
)
group by accountnum,itemnum,INVESTBY;
BEGIN
FOR
sched_rec IN
c1 LOOP
insert into
maximo.ccnbdet
(
CCNBDETID,
HASLD,
LANGCODE,
ACCOUNTNUM,
ITEMNUM,
INVESTBY,
AVG,
SITEID,
ORGID,
ROWSTAMP,
BILLSTATUS,
RUNDATE,
CYCLEID,
BILLYEARMONTH,
STARTDATE,
ENDDATE
)
select
maximo.CCNBDETIDSEQ.NEXTVAL,
sched_rec.hasld,
sched_rec.LANGCODE,
sched_rec.accountnum,
sched_rec.itemnum,
sched_rec.INVESTBY,
sched_rec.ct1,
'PQR',
'XYZ',
1,
'X',
V_RUNDT,
V_CYID,
V_YMNTH,
V_CCSD,
V_CCED
from dual;
END LOOP;
END;
COMMIT;
DECLARE CURSOR c2 IS
select
0 as hasld,
'EN' as LANGCODE,
accountnum as accountnum,
itemnum as itemnum,
INVESTBY as INVESTBY,
BILLSTATUS as BILLSTATUS,
sum(ct) as ct1 from
(
select
accountnum as accountnum ,
itemnum as itemnum,
INVESTBY as INVESTBY,
billstatus as billstatus ,
sum((( (V_CCSD-1) - billbegindate)/30)) as ct
from
maximo.sparepart where siteid = 'TD' and billstatus in ('Z') and billyearmonth = V_YMNTH and accountnum = V_ACC
group by accountnum,itemnum,INVESTBY,billstatus
union all
select
accountnum as accountnum ,
itemnum as itemnum,
INVESTBY as INVESTBY,
billstatus as billstatus ,
sum((( (V_CCSD-1) - billenddate)/30)) as ct
from
maximo.sparepart where siteid = 'TD' and billstatus in ('R') and billyearmonth = V_YMNTH and accountnum = V_ACC
group by accountnum,itemnum,INVESTBY,billstatus
)
group by accountnum,itemnum,INVESTBY,BILLSTATUS;
BEGIN
FOR
sched_rec1 IN
c2 LOOP
insert into
maximo.ccnbdet
(
CCNBDETID,
HASLD,
LANGCODE,
ACCOUNTNUM,
ITEMNUM,
INVESTBY,
AVG,
SITEID,
ORGID,
ROWSTAMP,
BILLSTATUS,
RUNDATE,
CYCLEID,
BILLYEARMONTH,
STARTDATE,
ENDDATE
)
select
maximo.CCNBDETIDSEQ.NEXTVAL,
sched_rec1.hasld,
sched_rec1.LANGCODE,
sched_rec1.accountnum,
sched_rec1.itemnum,
sched_rec1.INVESTBY,
sched_rec1.ct1,
'PQR',
'XYZ',
1,
sched_rec1.BILLSTATUS,
V_RUNDT,
V_CYID,
V_YMNTH,
V_CCSD,
V_CCED
from dual;
END LOOP;
END;
COMMIT;
End;