haozhenjie819


---创建目标数据库连接DBLINK
create database link testdblink
connect to xxx identified by "xxx"
using \'(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = xxx.xxx.x.x)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = emis)))\';


---创建存储过程

CREATE OR REPLACE PROCEDURE PROC_A IS
begin
merge into A@testdblink b
using A c
on (b.ID = c.ID)
when matched then
update set b.STATE = c.STATE where b.ID = c.ID
when not matched then
insert
(b.STATE,
b.ID)
values
(c.STATE,
c.ID);
commit;
end PROC_A;


--创建DBMS_JOBS定时器,定时执行存储过程
declare jobno number;
begin
dbms_job.submit(jobno,\'PROC_A;\', sysdate, \'sysdate+1/24/60\');
commit;
end;
/

分类:

技术点:

相关文章:

  • 2021-12-05
  • 2021-12-19
  • 2021-10-30
  • 2022-01-05
  • 2021-12-29
  • 2021-07-26
猜你喜欢
  • 2022-12-23
  • 2021-09-24
  • 2021-07-10
  • 2022-01-19
  • 2022-01-17
  • 2021-08-23
相关资源
相似解决方案