SQL> select * from test;
ID NAME
---------- ----------
1 aa
2 bbcreate or replace package pkg_getresultset
is
type ref_cursor is ref cursor;
function func_getresultset return ref_cursor;
end pkg_getresultset;
/
create or replace package body pkg_getresultset
is
function func_getresultset return ref_cursor
is
cur ref_cursor;
begin
open cur for
select * from test;
return cur;
end;
end pkg_getresultset;
/在自己的用户下面操作
SQL> select pkg_getresultset.func_getresultset from dual;
ID NAME
---------- ----------
1 aa
2 bb
正常显示。如果在例外的用户下通过dblink访问。报如下错误:
SQL> select pkg_getresultset.func_getresultset@dsdblink from dual;FUNC_GETRESULTSET
--------------------
CURSOR STATEMENT : 1CURSOR STATEMENT : 1未选定行ERROR:
ORA-01002: 读取违反顺序
ID NAME
---------- ----------
1 aa
2 bbcreate or replace package pkg_getresultset
is
type ref_cursor is ref cursor;
function func_getresultset return ref_cursor;
end pkg_getresultset;
/
create or replace package body pkg_getresultset
is
function func_getresultset return ref_cursor
is
cur ref_cursor;
begin
open cur for
select * from test;
return cur;
end;
end pkg_getresultset;
/在自己的用户下面操作
SQL> select pkg_getresultset.func_getresultset from dual;
ID NAME
---------- ----------
1 aa
2 bb
正常显示。如果在例外的用户下通过dblink访问。报如下错误:
SQL> select pkg_getresultset.func_getresultset@dsdblink from dual;FUNC_GETRESULTSET
--------------------
CURSOR STATEMENT : 1CURSOR STATEMENT : 1未选定行ERROR:
ORA-01002: 读取违反顺序
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货