- SQL code
SQL> select table_name from user_tables where table_name like 'T_';TABLE_NAME------------------------------TBT5T4T2T1
- SQL code
declare s varchar2(100);begin for x in (select table_name from user_tables where table_name like 'T_') loop s := 'drop table :1'; dbms_output.put_line(s); execute immediate s using x.table_name; end loop;end;
错误如下:请问这是怎么回事啊?
- SQL code
drop table :1declare*ERROR at line 1:ORA-00903: invalid table nameORA-06512: at line 7
------解决方案--------------------
s := 'drop table :1';
dbms_output.put_line(s);
execute immediate s using x.table_name;
因为你这段话等效于
drop table 'T1';
------解决方案--------------------
------解决方案--------------------
在表名上有所有无法处理了