创建表DB2 SQLSTATE:42601,SQL代码:-104):DB2 SQL错误:SQL代码= -104,SQL状态=42601

093gszye  于 2022-11-07  发布在  DB2
关注(0)|答案(1)|浏览(563)

我尝试使用以下内容创建DB2表

CREATE TABLE ACQ_FAH_DEV.fah_balance_ledger
(
    "ACTIVE" VARCHAR(10),
    INPUT_BY VARCHAR(32),
    INPUT_TIME DATE,
    AMENDED_BY VARCHAR(32),
    AMENDED_TIME DATE,
    ENTITY VARCHAR(20),
    ACCOUNT_CODE VARCHAR(20),
    ACCOUNT_NAME VARCHAR(255),
    PORTFOLIO_CODE VARCHAR(100),
    OM_LOAD_RUN_ID VARCHAR(128) NOT NULL,    
    OM_LOAD_TMST TIMESTAMP(6) NOT NULL,    
    BM_BUSINESS_INTERVAL_TYP VARCHAR(20) NOT NULL,
    BM_BUSINESS_INTERVAL_TMST TIMESTAMP(6) NOT NULL,    
    BM_BUSINESS_INTERVAL_START_END_FLAG VARCHAR(10) NOT NULL,    
    SM_SOURCE_SYSTEM_CD VARCHAR(16) NOT NULL,    
    OM_UNIQUE_ROW_ID BIGINT NOT NULL,    
    OM_USER_ID VARCHAR(100) NOT NULL,    
    OM_VERSION_ID SMALLINT NOT NULL
)
ORGANIZE BY COLUMN IN ACQ_FAH_DEV
DISTRIBUTE BY HASH(
    ACCOUNT_CODE,
    OM_VERSION_ID,
    BM_BUSINESS_INTERVAL_TYP
);

但遇到这个错误
(SQL状态:42601,SQL代码:-104):DB2 SQL错误:SQL代码= -104,SQL状态=42601,SQLERRMC=(;参数的类型二进制,驱动程序=4.26.14 SQLSTATE 42601:字符、标记或子句无效或缺失。SQL 0104 N在“LOAD_RUN_ID VARCHAR”后面发现意外的标记“(“。预期的标记可能包括:“二进制”。
这个错误看起来无伤大雅,但我不能理解为什么这会失败。

e7arh2l6

e7arh2l61#

对于LUW,表空间子句应该在organized子句之前(我假设IN ACQ_FAH_DEV指的是将表放入哪个表空间)。

CREATE TABLE ACQ_FAH_DEV.fah_balance_ledger
(
    "ACTIVE" VARCHAR(10),
    INPUT_BY VARCHAR(32),
    INPUT_TIME DATE,
    AMENDED_BY VARCHAR(32),
    AMENDED_TIME DATE,
    ENTITY VARCHAR(20),
    ACCOUNT_CODE VARCHAR(20),
    ACCOUNT_NAME VARCHAR(255),
    PORTFOLIO_CODE VARCHAR(100),
    OM_LOAD_RUN_ID VARCHAR(128) NOT NULL,
    OM_LOAD_TMST TIMESTAMP(6) NOT NULL,
    BM_BUSINESS_INTERVAL_TYP VARCHAR(20) NOT NULL,
    BM_BUSINESS_INTERVAL_TMST TIMESTAMP(6) NOT NULL,
    BM_BUSINESS_INTERVAL_START_END_FLAG VARCHAR(10) NOT NULL,
    SM_SOURCE_SYSTEM_CD VARCHAR(16) NOT NULL,
    OM_UNIQUE_ROW_ID BIGINT NOT NULL,
    OM_USER_ID VARCHAR(100) NOT NULL,
    OM_VERSION_ID SMALLINT NOT NULL
)
IN ACQ_FAH_DEV
ORGANIZE BY COLUMN
DISTRIBUTE BY HASH(
    ACCOUNT_CODE,
    OM_VERSION_ID,
    BM_BUSINESS_INTERVAL_TYP
);

Documentation for CREATE TABLE statement

相关问题