利用dblink调用远端DB的存储过程出错的原因

来源:互联网 发布:linux基础知识 编辑:程序博客网 时间:2024/06/06 03:04
在远端procedure中插入一条pragma autonomous_transaction;,即,远端procedure应该这么写:
create or replace procedure p_trunc_remote_tab(p_tname in varchar2,
                                               p_error out varchar2) is
  pragma autonomous_transaction;  --因为跨库操作,这里使用了“独立事物”
begin
  execute immediate 'TRUNCATE TABLE '||p_tname;
exception
  when others then
    p_error:=SQLERRM;
end;

让后在本地procedure利用dblink调用这个存储过程就ok了
原创粉丝点击