从命令行删除具有小写名称的 table

Drop table that has the name in lower case from the command line

我需要删除具有小写名称的 table,即 academy

然而,当我执行 db2 drop table academydb2 drop table "academy" 时,我得到:

DB21034E  The command was processed as an SQL statement because it was not a 
valid Command Line Processor command.  During SQL processing it returned:
SQL0204N  "DB2INST1.ACADEMY" is an undefined name.  SQLSTATE=42704

同样的命令也适用于大写 table 名称。

当我列出我的 table 时,我有 > db2 LIST TABLES

Table/View                      Schema          Type  Creation time             
------------------------------- --------------- ----- --------------------------
AA                              DB2INST1        T     2016-06-07-14.23.08.927146
MYNEWTABLE                      DB2INST1        T     2016-06-07-14.29.50.859806
academy                         DB2INST1        T     2016-06-07-17.05.27.510905

尝试从 "academy" 执行 select *,看看它是否会调用 table。如果是这样,您应该能够再次 运行 相同的查询,只需将单词 "select" 替换为 "drop"。

db2 drop table "academy" 中引号被 shell 吞没了。你需要逃避它们:

db2 drop table \"academy\" 

或引用整个声明:

db2 'drop table "academy"'