怎么了,我无法创建这个 table

What's wrong, I cannot create this table

那是我第一次使用 Firebird。我正在尝试创建此 table。我检查了文档,似乎没问题。怎么了?

CREATE TABLE ENDERECO 
(
      ID_ENDERECO INTEGER generated by default as identity primary KEY,
     RUA VARCHAR(50), 
     BAIRRO VARCHAR(35),
     CEP VARCHAR(10),
     COMPLEMENTO VARCHAR(35),
     ECOMERCIO INTEGER(1),
     ESTADO CHAR(2)

)

问题出在您对 INTEGER(1) 的使用上。数据类型 INTEGER(以及 SMALLINTBIGINT)在其定义中没有精度。另请参阅 Firebird 3 语言参考中的 Data Type Declaration Syntax

<domain_or_non_array_type> ::=
    <scalar_datatype>
  | <blob_datatype>
  | [TYPE OF] domain
  | TYPE OF COLUMN rel.col

<scalar_datatype> ::=
    SMALLINT | INT[EGER] | BIGINT
  | FLOAT | DOUBLE PRECISION
  | BOOLEAN
  | DATE | TIME | TIMESTAMP
  | {DECIMAL | NUMERIC} [(precision [, scale])]
  | {VARCHAR | {CHAR | CHARACTER} VARYING} (length)
    [CHARACTER SET charset]
  | {CHAR | CHARACTER} [(length)] [CHARACTER SET charset]
  | {NCHAR | NATIONAL {CHARACTER | CHAR}} VARYING (length)
  | {NCHAR | NATIONAL {CHARACTER | CHAR}} [(length)]

简而言之,使用:

CREATE TABLE ENDERECO 
(
     ID_ENDERECO INTEGER generated by default as identity primary KEY,
     RUA VARCHAR(50), 
     BAIRRO VARCHAR(35),
     CEP VARCHAR(10),
     COMPLEMENTO VARCHAR(35),
     ECOMERCIO INTEGER,
     ESTADO CHAR(2)
)