oracle 游标循环删除表数据 sql
2011-11-03 18:22
330 查看
declare
cursor table_user is
select table_name from user_tables where table_name not like 'resthome';
table_name varchar(40);
begin
open table_user;
fetch table_user
into table_name;
while table_user%found
loop
--dbms_output.put_line('delete from '||table_name);
---执行拼接字符串
execute immediate 'delete from '||table_name;
fetch table_user
into table_name;
end loop;
close table_user;
commit;
end;
cursor table_user is
select table_name from user_tables where table_name not like 'resthome';
table_name varchar(40);
begin
open table_user;
fetch table_user
into table_name;
while table_user%found
loop
--dbms_output.put_line('delete from '||table_name);
---执行拼接字符串
execute immediate 'delete from '||table_name;
fetch table_user
into table_name;
end loop;
close table_user;
commit;
end;
相关文章推荐
- 利用oracle动态游标实现动态SQL循环遍历
- ORACLE中如何用一条SQL语句删除一个表中所有某个列的值为空的数据?
- Oracle 删除重复数据只留一条 查询及删除重复记录的SQL语句 1、查找表中多余的重复记录,重复记录是根据单个字段(Id)来判断 select * from 表 wher
- SQL查询遍历数据方法二 [ 游标 + While循环]
- oracle删除分区、子分区,元数据和和只清除分区、子分区数据sql
- Oracle用游标删除重复数据
- Oracle 10g使用游标更新或删除数据
- Oracle 参数 游标[游标更新删除数据]|转|
- [oracle]删除一张表中重复数据,保留其id字段最小的sql
- [Oracle]在PL/SQL中更改数据和使用游标获取数据
- 使用SQL游标进行循环插入数据
- 删除表中重复的数据(oracle,sql)
- zz:【总结】oracle恢复误删除数据,解除锁定的等sql语句
- Oracle游标-循环查询表中数据(表名),并执行
- oracle pl/sql 程序块,游标,生成测试数据
- oracle恢复误删除数据,解除锁定的等sql语句
- 用SQL游标遍历循环数据的方法
- oracle创建删除表空间、用户、数据导入导出等常用sql语句
- oracle pl_sql 通过游标循环取数字的方法
- SQL查询遍历数据方法二 [ 游标 + While循环]