declare
v_name all_tables.table_name%type;
cursor mycur is select table_name from all_tables where owner='TEST';
begin
open mycur;
loop
fetch mycur into v_name;
exit when mycur%NOTFOUND OR mycur%NOTFOUND IS NULL;
execute immediate 'drop table '|| v_name;
end loop;
close mycur;
end;
本文介绍了一种使用PL/SQL过程批量删除Oracle数据库中特定所有者下所有表的方法。通过定义游标并遍历获取的所有表名,利用动态SQL执行DROP TABLE语句实现目标。
2327

被折叠的 条评论
为什么被折叠?



