14

I have having trouble getting HSQLDB to create a table with a boolean column. It seems every time I try to specify a default, I get the exception:

org.hsqldb.HsqlException: unexpected token: DEFAULT

I can create this problem even with this trivial table definition:

CREATE TABLE foo (
  bar BOOLEAN NOT NULL DEFAULT FALSE
);

According to the documentation, I should be able to do this!

See columnDefinition in http://www.hsqldb.org/doc/guide/ch09.html#create_table-section

Have I misunderstood something here?

4

1 回答 1

26

从提供的 HSQLDB文档中,正确的语法是

CREATE TABLE foo (
  bar BOOLEAN DEFAULT FALSE NOT NULL
);

即 SQL 中的顺序很重要

于 2013-08-26T17:08:45.563 回答