delare
tbl_name varchar2(256);
cursor drop_cs
is
select table_name from user_table where table_name like 'gn_%';
begin
open drop_cs;
while drop_cs%found
loop
fetch drop_cs into tbl_name;
execute immediate 'drop table '||tbl_name;
end loop;
end;
/
tbl_name varchar2(256);
cursor drop_cs
is
select table_name from user_table where table_name like 'gn_%';
begin
open drop_cs;
while drop_cs%found
loop
fetch drop_cs into tbl_name;
execute immediate 'drop table '||tbl_name;
end loop;
end;
/
要用动态的PL/SQL:execute immediate 'drop table '||tbl_name;
一行也有问题
oracle表名一般都是大写的,这一行查不到数据的应改为select table_name from user_table where table_name like 'GN_%';