标签:数据库 ble for blink ice loop dblink ber 同步
create public database link link_mm_dev
connect to stl identified by fosssit
using ‘(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.111)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = fossdbsb)
)
)‘;
--1 link_mm_dev dblink名称
--2 %MM% 外部数据库 需要的表
declare
num number(1);
begin
for v_row in (select t.table_name
from user_tables@link_mm_dev t
where t.table_name like ‘%MM%‘) loop
select count(1)
into num
from user_tables t
where t.table_name = v_row.table_name;
if num > 0 then
execute immediate ‘drop table ‘ || v_row.table_name;
num:=0;
end if;
execute immediate ‘create table ‘ || v_row.table_name ||
‘ as select * from ‘ || v_row.table_name||‘@link_mm_dev‘;
end loop;
end;
标签:数据库 ble for blink ice loop dblink ber 同步
原文地址:http://www.cnblogs.com/zfzf1/p/7088975.html