Oracle 导表异常处理方案 (解决空表导出出错问题)

Select 'alter table '||table_name||' allocate extent;' from  user_tables where num_rows=0 or num_rows is null

然后执行查询语句  再导出数据

一个语句搞定:

declare stmt varchar2(200);

  begin
    for tb in (select table_name from user_tables where segment_created = 'NO') loop
      stmt := 'alter table ' || tb.table_name || ' allocate extent';
    begin
      execute immediate stmt;
    exception
    when others then
    dbms_output.put_line(stmt);
    end;
  end loop;
end;

 

原文地址:https://www.cnblogs.com/auldlangsynezh/p/7993787.html