给HSQLDB的TEXT Table建索引
如题,有谁用过HSQLDB,知道如何给TEXT Table建索引,我操作报错如下:
java.sql.SQLException: operation is not allowed on text table with data in statement [CREATE INDEX INDEX_1 ON BI_TEXT("INSTITUTION NAME", "CITY HEADING", "BIC CODE", "BRANCH CODE", "UNIQUE BIC CODE", "UNIQUE BRANCH CODE", "IBAN BIC CODE", "IBAN BRANCH CODE", "PARENT BANK CODE", "COUNTRY CODE", "NATIONAL ID", "UNIQUE NATIONAL ID", "IBAN COUNTRY CODE", "IBAN NATIONAL ID", "UNIQUE IBAN NATIONAL ID", "SERVICE CODES")]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)
at HSQLDBTest.main(HSQLDBTest.java:75)
Caused by: org.hsqldb.HsqlException: operation is not allowed on text table with data
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.TableWorks.checkModifyTable(Unknown Source)
at org.hsqldb.TableWorks.addIndex(Unknown Source)
at org.hsqldb.StatementSchema.getResult(Unknown Source)
at org.hsqldb.StatementSchema.execute(Unknown Source)
at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
at org.hsqldb.Session.executeDirectStatement(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 3 more
貌似,不能给TEXT Table建索引,求高人指点。
[解决办法]
找到原因了,是因为SET TABLE SOURCE和CREATE INDEX的顺序不对造成的,应该是先create text table,然后createindex,然后set table source。