很不幸,执行一个简的SQL语句,又双叕报错了!
DB2真的是一个坑爹的数据库,经常出一些莫名其妙的错误。
执行的SQL语句为:
CREATE TABLE TEST_SCHEMA.TEST1 LIKE TEST_SCHEMA.TEST2;
根据一张旧表,创建一张相同结构的新表,结果报错如下:
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0101N The statement was not processed because a limit such as a memory limit,an SQL limit,or a database limit was reached. SQLSTATE=54001
经分析,报错原因为来源表字段个数太多,有300多个字段。导致触发了某个数据库限制的阀值,所以报错了。
对于SQLSTATE=54001这个错误,在执行DB2的SQL语句中,经常遇到。一般来说,可能是语句太复杂,需要对SQL进行简化。
对于上面的报错,我的处理方法为,修改LIKE的用法为直接创建表:
CREATE TABLE TEST_SCHEMA.TEST1( col1... col2... col3... ... );