一、在数据库A中:
1、有过程PA:
create or replace procedure PA(cur_a out sys_refcursor) is
begin
...
open cur_a for select * from table_a;
end PA;
二、数据库B中:
1、建有到A的DB LINK链接(名为btoalink)
2、建有调用PA的过程PB:
create or replace procedure PB is
cur_b sys_refcursor;
row_b table_b%rowtype; --table_b与table_a的表结构相同
begin
PA(cur_b)@btoalink;
loop
fetch cur_b into row_b; --此处出错:无效的游标
exit when cur_b%notfound;
dbms_output.put_line(row_b.id);
end loop;
close cur_b;
end PB;
问题:执行PB时报错“无效的游标”。
1、为何出错?
2、如何解决?
3、最好能给出远程游标的运行机制?
1、有过程PA:
create or replace procedure PA(cur_a out sys_refcursor) is
begin
...
open cur_a for select * from table_a;
end PA;
二、数据库B中:
1、建有到A的DB LINK链接(名为btoalink)
2、建有调用PA的过程PB:
create or replace procedure PB is
cur_b sys_refcursor;
row_b table_b%rowtype; --table_b与table_a的表结构相同
begin
PA(cur_b)@btoalink;
loop
fetch cur_b into row_b; --此处出错:无效的游标
exit when cur_b%notfound;
dbms_output.put_line(row_b.id);
end loop;
close cur_b;
end PB;
问题:执行PB时报错“无效的游标”。
1、为何出错?
2、如何解决?
3、最好能给出远程游标的运行机制?
·You cannot use RPCs (Remote Procedure Calls) to pass cursor variables from one server to another.