您的位置:首页 > 数据库 > Oracle

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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: