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

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;

你可能感兴趣的:(oracle)