执行存储过程时报错:高手快帮忙解决下!!!!!!!!!SQL> execute COORDINATE.prc
BEGIN COORDINATE.prc; END;                 *
第 1 行出现错误:
ORA-06550: 第 1 行, 第 18 列:
PLS-00225: 子程序或游标 'COORDINATE' 引用超出范围
ORA-06550: 第 1 行, 第 7 列:
PL/SQL: Statement ignored存储过程:
create or replace procedure coordinate
as
-- 判断实体A是否存于关系网中
ca integer; 
-- 判断实体B是否存于关系网中
cb integer;
-- 实体A所在关系网编号
linkAid varchar2(32);
-- 实体B所在关系网编号
linkBid varchar2(32);
-- 关系网表T_ENTITY_LINK主键
nextLinkId varchar2(32);
-- 辅助关系表M_A_LINK主键
nextMid varchar2(32);
-- 关系表T_ENTITY_STLINK主键
v_bh varchar2(50);
-- 实体A编号
v_stabh varchar2(50);
-- 实体A表名
v_stayb varchar2(60);
-- 实体B编号
v_stbbh varchar2(50);
-- 实体B表名
v_stbyb varchar2(60);
-- 实体A类别
v_ashort varchar2(30);
-- 实体B类别
v_bshort varchar2(30);
-- v_bh1/v_bh2 辅助作用编号
v_bh1 integer;
v_bh2 integer;
-- 实体A所在关系网节点数量
v_AnodeCount integer;
-- 实体B所在关系网节点数量
v_BnodeCount integer;
-- 实体类别
v_shortname varchar2(32);
-- 实体表名
v_tablename varchar2(60);
-- 关系数据编号
v_id varchar2(50);
-- 关系点A
v_sourceId varchar2(50);
-- 关系点B
v_targetId varchar2(50);
-- 错误提示
v_error varchar2(200);

--声明游标(需要整合的关系数据)
    cursor cur is
    select
    bh,stabh,stayb,stbbh,stbyb
    from t_entity_stlink where rev8='0';
begin
for v_obj in cur loop
v_bh := v_obj.bh;
v_stabh := v_obj.stabh;
v_stayb := v_obj.stayb;
v_stbbh := v_obj.stbbh;
v_stbyb := v_obj.stbyb;
-- 查询实体A在几个link中
select count(1) into ca from m_a_link where st_id = v_stayb||'|'||v_stabh;
-- 查询实体B在几个link中
select count(1) into cb from m_a_link where st_id = v_stbyb||'|'||v_stbbh;
-- 查询实体A的类别
select shortname into v_ashort from t_sys_util where tablename = v_stayb;
-- 查询实体B的类别
select shortname into v_bshort from t_sys_util where tablename = v_stbyb;
begin
if(ca = 0 and cb = 0) then
v_error:='insert';
-- 获取编号
select 'EL'||(select bzzh from t_sys_productinfo where id='000000000000000000000000000001')||lpad(EntityLinkNo.nextval,19,'0') 
into nextLinkId from dual;
-- 新增一条关系网记录
insert into T_ENTITY_LINK(BH,JLSJ,JLQR,SFYYP,SJGX,DEL,SECRECY,CREATE_DATE,CREATE_PID,MODIFY_DATE,MODIFY_PID) 
values ( nextLinkId,sysdate,'1','1',null,'0','1',sysdate,'999999',sysdate,'999999');
-- 写入关系XML
update t_entity_link set sjgx = Xmltype('<?xml version="1.0" encoding="UTF-8"?>
<graphml>
  <graph edgedefault="undirected">
<key id="name" for="node" attr.name="name" attr.type="string"></key>
<key id="type" for="node" attr.name="type" attr.type="string"></key>
<key id="table" for="node" attr.name="table" attr.type="string"></key>
<node id="'||v_stabh||'">
<data key="type">'||v_ashort||'</data>
<data key="table">'||v_stayb||'</data>
<data key="name">'||v_stabh||'</data>
</node>
<node id="'||v_stbbh||'">
<data key="type">'||v_bshort||'</data>
<data key="table">'||v_stbyb||'</data>
<data key="name">'||v_stbbh||'</data>
</node>
<edge source="'||v_stabh||'" target="'||v_stbbh||'" id="'||v_bh||'"/>
 </graph>
</graphml>') 
where bh = nextLinkId;
commit;
-- 关系写入M_A_LINK中
select 'MA'||(select bzzh from t_sys_productinfo where id='000000000000000000000000000001')||lpad(MLINKNO.nextval,21,'0') into nextMid from dual;
insert into m_a_link values(nextMid,nextLinkId,v_stayb||'|'||v_stabh, (select id from t_sys_util where tablename = v_stayb));
select 'MA'||(select bzzh from t_sys_productinfo where id='000000000000000000000000000001')||lpad(MLINKNO.nextval,21,'0') into nextMid from dual;
insert into m_a_link values(nextMid,nextLinkId,v_stbyb||'|'||v_stbbh, (select id from t_sys_util where tablename = v_stbyb));
--新增记录
commit;
end if;

if(ca = 1 and cb = 0) then
v_error:='oneUpdate';
-- 找出实体A所在的关系网
select link_id into linkAid  from m_a_link where st_id = v_stayb||'|'||v_stabh;
-- 把stbbh加入到linkAid的xml中,先加node ,再加edge
update t_entity_link set sjgx = APPENDCHILDXML(sjgx,'graphml/graph', XMLType('<node id="'||v_stbbh||'">
      <data key="type">'||v_bshort||'</data>
      <data key="table">'||v_stbyb||'</data>
      <data key="name">'||v_stbbh||'</data>
    </node>')), modify_date = sysdate
    where bh = linkAid;
update t_entity_link set sjgx = APPENDCHILDXML(sjgx,'graphml/graph', XMLType('<edge source="'||v_stabh||'" target="'||v_stbbh||'" id="'||v_bh||'"/>')) , modify_date = sysdate
    where bh = linkAid;
commit;
-- 实体B和关系网linkAid的关系写入M_A_LINK中
select 'MA'||(select bzzh from t_sys_productinfo where id='000000000000000000000000000001')||lpad(MLINKNO.nextval,21,'0') into nextMid from dual;
insert into m_a_link values(nextMid,linkAid,v_stbyb||'|'||v_stbbh, (select id from t_sys_util where tablename = v_stbyb));
end if;

if(ca = 0 and cb = 1) then
v_error:='oneUpdate';
-- 找出实体B所在的关系网
select link_id into linkBid  from m_a_link where st_id = v_stbyb||'|'||v_stbbh;
-- 把stabh加入到linkBid的xml中,先加node ,再加edge
update t_entity_link set sjgx = APPENDCHILDXML(sjgx,'graphml/graph', XMLType('<node id="'||v_stabh||'">
      <data key="type">'||v_ashort||'</data>
      <data key="table">'||v_stayb||'</data>
      <data key="name">'||v_stabh||'</data>
    </node>')) , modify_date = sysdate
    where bh = linkBid;
update t_entity_link set sjgx = APPENDCHILDXML(sjgx,'graphml/graph', XMLType('<edge source="'||v_stabh||'" target="'||v_stbbh||'" id="'||v_bh||'"/>')) , modify_date = sysdate
    where bh = linkBid;
commit;
-- 实体A和关系网linkBid的关系写入M_A_LINK中
select 'MA'||(select bzzh from t_sys_productinfo where id='000000000000000000000000000001')||lpad(MLINKNO.nextval,21,'0') into nextMid from dual;
insert into m_a_link values(nextMid,linkBid,v_stayb||'|'||v_stabh, (select id from t_sys_util where tablename = v_stayb));
end if;

if(ca = 1 and cb = 1) then
v_error:='coor';
select link_id into linkAid  from m_a_link where st_id = v_stayb||'|'||v_stabh;
select link_id into linkBid  from m_a_link where st_id = v_stbyb||'|'||v_stbbh;
v_error:='coor1';
if(linkAid = linkBid) then
-- 增加关系 ,先判断关系存在不存在
v_error:='coor2';
select count(1) into v_bh1 from t_entity_link where 
EXISTSNODE(sjgx, '/graphml/graph/edge[@source="'||v_stabh||'" and @target="'||v_stbbh||'"]') = 1 and bh = linkAid;
select count(1) into v_bh2 from t_entity_link where 
EXISTSNODE(sjgx, '/graphml/graph/edge[@source="'||v_stbbh||'" and @target="'||v_stabh||'"]') = 1 and bh = linkAid;
v_error:='coor3';
if(v_bh1 = 1 or v_bh2 = 1) then
     --有就不用增加关系
     DBMS_OUTPUT.put_line('');
else
v_error:='coor4';
--没有就增加关系
    update t_entity_link set sjgx = APPENDCHILDXML(sjgx,'graphml/graph', XMLType('<edge source="'||v_stabh||'" target="'||v_stbbh||'" id="'||v_bh||'"/>')) , modify_date = sysdate
     where bh = linkAid;
     v_error:='coor5';
commit;
end if;
else
-- stabh 和 stbbh分布在不同的link里面,就要考虑两个link合并
-- 查询两个link里面的节点数,把数量少的合并到数量多的里面
v_error:='coor6';
select count(1) into v_AnodeCount from t_entity_link,XMLTABLE('/graphml/graph/node' PASSING t_entity_link.sjgx) a WHERE bh=linkAid;
select count(1) into v_BnodeCount from t_entity_link,XMLTABLE('/graphml/graph/node' PASSING t_entity_link.sjgx) a WHERE bh=linkBid;
v_error:='coor7';
if(v_AnodeCount>v_BnodeCount) then
-- 将linkBid的数据整合到linkAid里面
begin
v_error:='coor8';
MAKEAWITHBLINK(linkAid,linkBid,v_stabh,v_stbbh,v_bh);
end;
else
-- 将linkAid的数据整合到linkBid里面
begin
v_error:='coor9';
MAKEAWITHBLINK(linkBid,linkAid,v_stabh,v_stbbh,v_bh);
end;
end if;

end if;

end if;

 ----- 异常处理
     exception WHEN OTHERS THEN
        insert into temp_xml values(v_bh,v_error);
    end;
    update t_entity_stlink set rev8='1' where bh = v_bh;
    
    commit;
end loop;
end coordinate;