存储过程 求大神帮忙 编译出错 提示 PLS-00103: 出现符号 "end-of-file"在需要下列之一

echo5222 2015-06-15 11:29:31
create or replace procedure GroupPartRefond(groupid in integer,grouppeocount in integer, resout out integer) is
grouppassaccount integer;
mincou integer;
v_pt_id integer;
v_cou integer;
v_sql_str clob;
cursor a_cursor is
select pt.id,count(pi.id) cou from plane_timetable pt right join seats_info si on si.planetimetableid =pt.id
right join passenger_info pi on pi.seatsid =si.id
where pi.gid= groupid and pi.isdelete='0' and si.isdelete='0' and pt.isdelete='0' and pi.name is null group by pt.id;
b_cursor RefCursor.t_Refcursor;
BEGIN
open a_cursor;
loop
fetch a_cursor into v_pt_id,v_cou;
exit when a_cursor%notfound;
v_sql_str :=v_sql_str+ 'union select id, gid, name, gender, age, idnumber, passport, seatsid,phonenum,seatnumber,ptname,rownum from (
select pi.id, pi.gid, pi.name, pi.gender, pi.age, pi.idnumber, pi.passport, pi.seatsid,pi.phonenum,si.seatnumber,pt.ptname
from passenger_info pi left join seats_info si on pi.seatsid =si.id left join plane_timetable pt on si.planetimetableid =pt.id
where pi.gid='+groupid+ ' and pi.isdelete='||0||' and si.isdelete='||0||' and pt.isdelete='||0||' and (pi.name='' or pi.name is null) and pt.id='+v_pt_id+' order by pi.id desc) where rownum <= '+mincou+' ';

end loop;
close a_cursor;
v_sql_str:= substr(v_sql_str,1,5);
OPEN b_cursor FOR v_sql_str;
begin
select min(cou) into mincou from (
select pt.id,count(pi.id) cou from plane_timetable pt right join seats_info si on si.planetimetableid =pt.id
right join passenger_info pi on pi.seatsid =si.id
where pi.gid= groupid and pi.isdelete='0' and si.isdelete='0' and pt.isdelete='0' and pi.name is null group by pt.id);
select count(id) into grouppassaccount from group_passenger where gid =groupid;

if(grouppassaccount<=(grouppeocount-mincou)) then

--update group_info set gpeocounts = v_gpeocounts,where gid = v_gid,
-- resout:=3;
open b_cursor;
loop
fetch b_cursor into v_pt_id,v_cou;
exit when b_cursor%notfound;
resout:=6;
end loop;
close b_cursor;
else
resout:=4;
end if;
end GroupPartRefond;


PROCEDURE LJTEST.GROUPPARTREFOND 编译错误

错误:PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
( begin case
declare end exception exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
continue close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe purge
行:47
文本:end GroupPartRefond;
...全文
4622 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
碧水幽幽泉 2015-06-19
  • 打赏
  • 举报
回复

多了一个bin,
select min(cou) into mincou from ....

或少了一个end
end;
end GroupPartRefond;
IceIsabel 2015-06-15
  • 打赏
  • 举报
回复
中间多了一个begin
begin
select min(cou) into mincou from (

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧