通过DB link进行远程过程或函数调用
来源:百度文库 编辑:神马文学网 时间:2024/05/02 07:22:43
有朋友在留言板问:如何通过动态sql远程调用包里面的函数,并返回值。我简单做了一个例子,实现以上要求.
首先进行适当授权:
[oracle@jumper oracle]$ sqlplus "/ as sysdba"SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 7 21:07:56 2006Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - ProductionSQL> grant create public database link to eygle;Grant succeeded.
SQL> grant all on dbms_flashback to eygle;Grant succeeded.
建立DB Link:
SQL> connect eygle/eygle
Connected.
SQL> create public database link hsbill using 'hsbill';Database link created.SQL> select db_link from dba_db_links;DB_LINK
---------------------------------------------------
HSBILLSQL> select * from dual@hsbill;D
-
X
此后可以尝试使用DB Link进行远程和本地执行:SQL> set serveroutput on
SQL> set feedback off
declare
r_gname varchar2(40);
l_gname varchar2(40);
begin
execute immediate
'select GLOBAL_NAME from global_name@hsbill' into r_gname;
dbms_output.put_line('gname of remote:'||r_gname);
select GLOBAL_NAME into l_gname from global_name;
dbms_output.put_line('gname of locald:'||l_gname);
end;
/
gname of remote:HSBILL.HURRAY.COM.CN
gname of locald:EYGLE远程Package或Function调用也可以随之实现:SQL> declare
2 r_scn number;
3 l_scn number;
4 begin
5 execute immediate
6 'select dbms_flashback.GET_SYSTEM_CHANGE_NUMBER@hsbill from dual' into r_scn;
7 dbms_output.put_line('scn of remote:'||r_scn);
8 end;
9 /
scn of remote:18992092687SQL> -The End-
首先进行适当授权:
[oracle@jumper oracle]$ sqlplus "/ as sysdba"SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 7 21:07:56 2006Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - ProductionSQL> grant create public database link to eygle;Grant succeeded.
SQL> grant all on dbms_flashback to eygle;Grant succeeded.
建立DB Link:
SQL> connect eygle/eygle
Connected.
SQL> create public database link hsbill using 'hsbill';Database link created.SQL> select db_link from dba_db_links;DB_LINK
---------------------------------------------------
HSBILLSQL> select * from dual@hsbill;D
-
X
此后可以尝试使用DB Link进行远程和本地执行:SQL> set serveroutput on
SQL> set feedback off
declare
r_gname varchar2(40);
l_gname varchar2(40);
begin
execute immediate
'select GLOBAL_NAME from global_name@hsbill' into r_gname;
dbms_output.put_line('gname of remote:'||r_gname);
select GLOBAL_NAME into l_gname from global_name;
dbms_output.put_line('gname of locald:'||l_gname);
end;
/
gname of remote:HSBILL.HURRAY.COM.CN
gname of locald:EYGLE远程Package或Function调用也可以随之实现:SQL> declare
2 r_scn number;
3 l_scn number;
4 begin
5 execute immediate
6 'select dbms_flashback.GET_SYSTEM_CHANGE_NUMBER@hsbill from dual' into r_scn;
7 dbms_output.put_line('scn of remote:'||r_scn);
8 end;
9 /
scn of remote:18992092687SQL> -The End-
通过DB link进行远程过程或函数调用
dojo远程过程调用
通过字符串来动态调用函数
通过内核源码看函数调用之前世今生 - 极光 - CSDN博客
通过一个程序分析C++中析构与构造函数的调用顺序
论函数调用约定
函数调用约定
函数调用方式介绍
论函数调用约定
Java调用存储过程
系统调用过程
Java远程方法调用(1)
Java远程方法调用(2)
sql server compact 与 sql server 2005 通过远程访问进行数据同步-jeff chow-博客园
vbscript事件过程的调用
JDBC 驱动程序调用存储过程
通过向日葵控制远程主机
通过向日葵控制远程主机
Visual Basic中调用MSN API函数
AJAX 应用 - JavaScript调用C# 函数
Matlab 如何设置 自定义函数 的调用
matlab函数调用及数据传递(转载)
C中如何调用C++函数
电子侦察机能通过开机或关机的手机进行窃听