--Oracle Code
--建议你把这些表明存储到一个表里面
create or replace procedure updatetable
begin
cursor tp_cur is select 表名 from 存储表名的表;
tp_sql varchar2(400);
for lp_cur in tp_cur loop
dbms_output.put_line('now begin deleting table '||lp_cur.table_name);
tp_sql:='delete '||lp_cur.table_name||' where col_name....'; _____此处自己更改
execute immediate tp_sql;
dbms_output.put_line('finish deleting table '||lp_cur.table_name);
commit;
end loop;
end;
------解决方案--------------------
create or replace procedure proc_DealTables
as
sSql varchar2(2000);
cursor c1 is select Object_name from user_objects where Object_type='TABLE' ;--and otherswhere; 查询出你要删除的表名
begin
for c2 in c1 loop
sSql := ' delete from '||c2.table_name;
begin
execute immediate sSql;
exception
when others then
rollback;
end;
end loop;
end;
------解决方案-------------------- truncate 是把表数据都清空了,而且回滚不便。