SQL插入错误:ORA-00936

时间:2016-03-15 18:50:00

标签: sql oracle

我正在努力弄清楚这个SQL Insert语句到底出了什么问题。

INSERT INTO mpcs.shop_inventory (
    SI_KEY,
    INV_TYPE,
    MTI_PART_NO,
    BUILD_NO,
    SERIAL_NO,
    HOME_LOCATION,
    HOME_LOCATION_SUB,
    DESCRIPTION,
    CATEGORY,
    QUANTITY,
    MIN_QTY,
    CONSUMABLE,
    CUST_PART_NO,
    UOM,
    WEIGHT,
    SCRAP_FLAG,
    NEXT_CAL,
    INTERVAL,
    SIZE_1,
    SIZE_2,
    SIZE_3
    )
VALUES (
    28990,
    'TEST',
    '01400010002',
    0,
    '0',
    'DEPT-850',
    'DEPT-850',
    'Test',
    '001',
    1,
    0,
    0,
    '',
    'BOTTLES',
    '3',
    0,
    to_date('27-June-2008', 'DD-MON-YYYY'),
    0,
    ,
    ,
    )

2 个答案:

答案 0 :(得分:2)

与评论建议一样,尝试更改你的,,,而不是发送NULL值

INSERT INTO mpcs.shop_inventory (
    SI_KEY,
    INV_TYPE,
    MTI_PART_NO,
    BUILD_NO,
    SERIAL_NO,
    HOME_LOCATION,
    HOME_LOCATION_SUB,
    DESCRIPTION,
    CATEGORY,
    QUANTITY,
    MIN_QTY,
    CONSUMABLE,
    CUST_PART_NO,
    UOM,
    WEIGHT,
    SCRAP_FLAG,
    NEXT_CAL,
    INTERVAL,
    SIZE_1,
    SIZE_2,
    SIZE_3
    )
VALUES (
    28990,
    'TEST',
    '01400010002',
    0,
    '0',
    'DEPT-850',
    'DEPT-850',
    'Test',
    '001',
    1,
    0,
    0,
    '',
    'BOTTLES',
    '3',
    0,
    to_date('27-June-2008', 'DD-MON-YYYY'),
    0,
    NULL,
    NULL,
    NULL
    )

答案 1 :(得分:0)

Can use directly the columns you want to insert only in insert statement:

    INSERT INTO mpcs.shop_inventory (
        SI_KEY,
        INV_TYPE,
        MTI_PART_NO,
        BUILD_NO,
        SERIAL_NO,
        HOME_LOCATION,
        HOME_LOCATION_SUB,
        DESCRIPTION,
        CATEGORY,
        QUANTITY,
        MIN_QTY,
        CONSUMABLE,
        CUST_PART_NO,
        UOM,
        WEIGHT,
        SCRAP_FLAG,
        NEXT_CAL,
        INTERVAL
        )
    VALUES (
        28990,
        'TEST',
        '01400010002',
        0,
        '0',
        'DEPT-850',
        'DEPT-850',
        'Test',
        '001',
        1,
        0,
        0,
        '',
        'BOTTLES',
        '3',
        0,
        to_date('27-June-2008', 'DD-MON-YYYY'),
        0
        );

Just keep it simple.