当前位置: 代码迷 >> Oracle管理 >> ORA-00903: invalid table name解决思路
  详细解决方案

ORA-00903: invalid table name解决思路

热度:90   发布时间:2016-04-24 05:13:47.0
ORA-00903: invalid table name
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';
------解决方案--------------------
探讨
引用:
s := 'drop table :1';
dbms_output.put_line(s);
execute immediate s using x.table_name;
因为你这段话等效于
drop table 'T1';



SQL code




1 declare
2 s varchar2(100);
3……

------解决方案--------------------
在表名上有所有无法处理了
  相关解决方案