oracle存储过程处理ddl与dml语句

2/13/2017来源:SQL技巧人气:1569

declare   CURSOR C_EVENT is  select table_name from user_tables@DBLINK_YWKDB;      temp varchar2(100); begin       OPEN C_EVENT;    FETCH C_EVENT into temp;   while C_EVENT%found     Loop      EXECUTE IMMEDIATE 'truncate table '||temp;      EXECUTE IMMEDIATE 'INSERT INTO '||temp||' select * from '||temp||'@DBLINK_YWKDB';      FETCH C_EVENT into temp;    End Loop;    CLOSE C_EVENT;      end;