create or replace procedure drop_like_table(tablename in varchar2)
as
cursor curT is select table_name from user_tables where table_name like upper(tablename)||’%’ ;
begin
for cur1 in curT loop
begin
execute immediate ‘drop table ‘||cur1.table_name ;
dbms_output.put_line(‘drop table ‘||cur1.table_name);
end;
end loop;
end drop_like_table;
/
oracle 批量删除当前用户下以xxxx开头的表
最新推荐文章于 2023-06-15 11:21:58 发布
创建了一个名为drop_like_table的PL/SQL过程,用于删除当前用户下所有表名以指定字符串(tablename)开头的表。过程通过游标获取匹配的表名,然后逐个执行DROP TABLE语句。
2329

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



