您好我正在尝试执行oracle 11g存储过程。但是当我在其中使用select语句时收到错误。它指示的错误是SQL Statment被忽略。请帮助。这是我第一次创建存储过程和错误显示在第一个select语句中。我几乎尝试了Internet上可用的每个解决方案。请大家帮忙我会非常感谢。提前谢谢。我的代码如下,错误在第一个选择语句中
Create or replace Procedure Wf_disb_process is
cursor c1 is select count(1) cnt,agentcode,agent_name,invdt,disbvchno,disbdt,entryno,
divcode,rate_date,currcode,exchange_rate,vesname,
voynum,vescode,portcode,portname
from(
select distinct agentcode,partyname agent_name,invdt,disbvchno,disbdt,a.entryno,
b.divcode,rate_date,currcode,exchange_rate,vesname,
voynum,b.vescode,b.portcode,portname
from ftxndisbhdr a,ftxndisbdtl b ,cmstvessel c ,cmstport p,fmstacs g,cmstparty h
where b.vescode = c.vescode and p.portcode = b.portcode and g.glaccode = b.glaccode and a.agentcode=h.partycode and
a.entryno = b.entryno and a.entryno=67984 and invdt='25-jul-2014'
and billtype ='I' )
where entryno not in(select entryno from disb_inv_hdr)
group by agentcode,agent_name ,invdt,disbvchno,disbdt,entryno,
divcode,rate_date,currcode,exchange_rate,vesname,
voynum,vescode,portcode,portname;
cursor c2 is select
a.agentcode,a.agent_name,a.artcode,a.invdt,a.invno,a.disbvchno,a.disbdt,a.entryno,
b.divcode,a.rate_date,a.currcode,a.exchange_rate,A.fcamt,B.FCAMT ACTAMT,a.vesname,
a.voynum,b.vescode,b.portcode,b.portname,b.remarks ,b.glaccode
FROM (select agentcode,partyname agent_name,artcode,invdt,invno,disbvchno,disbdt,a.entryno,
b.divcode,rate_date,currcode,exchange_rate,fcamt,inramt,vesname,
voynum,b.vescode,b.portcode,portname,b.remarks ,b.glaccode
from ftxndisbhdr a,ftxndisbdtl b ,cmstvessel c ,cmstport p,fmstacs g,cmstparty h
where b.vescode = c.vescode and p.portcode = b.portcode and g.glaccode = b.glaccode and a.agentcode=h.partycode and
a.entryno = b.entryno and a.entryno=67984
and billtype ='E') A,(select agentcode,partyname agent_name,artcode,invdt,invno,disbvchno,disbdt,a.entryno,
b.divcode,rate_date,currcode,exchange_rate,fcamt,inramt,vesname,
voynum,b.vescode,b.portcode,portname,b.remarks ,b.glaccode
from ftxndisbhdr a,ftxndisbdtl b ,cmstvessel c ,cmstport p,fmstacs g,cmstparty h
where b.vescode = c.vescode and p.portcode = b.portcode and g.glaccode = b.glaccode and a.agentcode=h.partycode and
a.entryno = b.entryno and a.entryno=67984
and billtype ='I' and invdt='25-jul-2014') B WHERE A.ENTRYNO=B.ENTRYNO ;
cursor c3 is select agentcode,partyname agent_name,disbvchno,disbdt,a.entryno
,rate_date,currcode,exchange_rate,SUM(fcamt) FCAMT,sum(inramt) inramt
from ftxndisbhdr a,ftxndisbdtl b ,cmstvessel c ,cmstport p,fmstacs g,cmstparty h
where b.vescode = c.vescode and p.portcode = b.portcode and g.glaccode = b.glaccode and a.agentcode=h.partycode and
a.entryno = b.entryno and a.entryno=67984
and billtype ='A'
group by
agentcode,partyname ,disbvchno,disbdt,a.entryno,rate_date,currcode,exchange_rate, FCAMT,inramt;
vid number;
vdtl_id number;
Vadv_fc number;
vadv_inr number;
Vinv_fc number;
vinv_inr number;
Vest_fc number;
vest_inr number;
begin
for c1_rec in c1
loop
select max(id_cd) into vid from disb_inv_hdr ;
if vid is null then
vid:=1;
else
vid:=vid+1;
end if;
insert into disb_inv_hdr (ID_CD,
ENTRYNO,
DISBVCHNO,
DOCUMENT_LINK,
DISBDT,
VESCODE,
VESNAME,
AGENTCODE,
AGENT_NAME,
VOYNUM,
PORTCODE,
PORT_NAME,
CURRCODE,
USER_CD,
UPDATED_DT,
CREATION_DT,
CREATED_BY,
UPDATED_BY,
OWNER,
COCODE,
DIVCODE,
EST_TOTAL,
ACTUAL_TOTAL,
DIFF_TOTAL,
ADVANCE_TOTAL) values
(vid,c1_rec.entryno,c1_rec.DISBVCHNO,
null,
c1_rec.DISBDT,
decode(c1_rec.cnt,1,c1_rec.VESCODE,'9999'),
decode(c1_rec.cnt,1,c1_rec.VESNAME,'NA'),
c1_rec.AGENTCODE,
c1_rec.AGENT_NAME,
decode(c1_rec.cnt,1,c1_rec.VOYNUM,999),
decode(c1_rec.cnt,1,c1_rec.PORTCODE,'NA'),
decode(c1_rec.cnt,1,c1_rec.PORTNAME,'NA'),
c1_rec.CURRCODE,
186,
null,
null,
null,
null,
null,
null,
null,0,0,0,0);
for c2_rec in c2
loop
select max(ID_DTL_CD) into vdtl_id from disb_inv_dtl ;
if vdtl_id is null then
vdtl_id:=1;
else
vdtl_id:=vdtl_id+1;
end if;
insert into disb_inv_dtl (ID_DTL_CD ,
ID_CD ,
ARTCODE ,
INVNO ,
INVDT ,
GLACCODE ,
EST_AMT ,
ACT_AMT ,
VESCODE ,
VESNAME ,
VOYNUM ,
PORTCODE ,
PORT_NAME ,
USER_CD ,
UPDATED_DT ,
CREATION_DT ,
CREATED_BY ,
UPDATED_BY ,
OWNER ,
COCODE ,
DIVCODE ,diff) values
(vdtl_id,vid,c2_rec.artcode,c2_rec.invno,c2_rec.invdt,c2_rec.glaccode,c2_rec.fcamt,c2_rec.actamt,
c2_rec.VESCODE,
c2_rec.vESNAME,
c2_rec.VOYNUM,
c2_rec.PORTCODE,
c2_rec.PORTNAME,
186,
null,
null,
null,
null,
null,
null,
null,c2_rec.fcamt-c2_rec.actamt);
end loop;
begin
select SUM(fcamt) FCAMT,sum(inramt) inramt into Vadv_fc, vadv_inr
from ftxndisbhdr a,ftxndisbdtl b ,cmstvessel c ,cmstport p,fmstacs g,cmstparty h
where b.vescode = c.vescode and p.portcode = b.portcode and g.glaccode = b.glaccode and a.agentcode=h.partycode and
a.entryno = b.entryno and a.entryno=67984
and billtype ='A';
exception
when no_data_found then
null;
end;
begin
select SUM(fcamt) FCAMT,sum(inramt) inramt into Vest_fc, vest_inr
from ftxndisbhdr a,ftxndisbdtl b ,cmstvessel c ,cmstport p,fmstacs g,cmstparty h
where b.vescode = c.vescode and p.portcode = b.portcode and g.glaccode = b.glaccode and a.agentcode=h.partycode and
a.entryno = b.entryno and a.entryno=67984
and billtype ='E';
exception
when no_data_found then
null;
end;
begin
select SUM(fcamt) FCAMT,sum(inramt) inramt into Vinv_fc, vinv_inr
from ftxndisbhdr a,ftxndisbdtl b ,cmstvessel c ,cmstport p,fmstacs g,cmstparty h
where b.vescode = c.vescode and p.portcode = b.portcode and g.glaccode = b.glaccode and a.agentcode=h.partycode and
a.entryno = b.entryno and a.entryno=67984
and billtype ='I';
exception
when no_data_found then
null;
end;
update disb_inv_hdr set est_total=vest_fc,actual_total=vinv_fc,diff_total=vest_fc-vinv_fc ,advance_total= vadv_fc where entryno=c1_rec.entryno;
end loop;
end;
/