SQL错误:ORA-00917:缺少逗号00917。00000-“缺少逗号” *原因:*操作:

时间:2020-10-25 23:16:06

标签: sql oracle insert-statement

我正在尝试向Products表中添加新行:

INSERT INTO Products_mgs( product_id,category_id,product_code,product_name,
description,list_price,discount_percent,date_added)
VALUES ( 11, 4,'YDP162R','Yamaha Arius YDP162R Traditional Console Style Digital Piano',
'The best keyboard on the market. Offers excellent sound rendering
 that truly separates it from the rest of the pack.',1599.99,10,'2020-10-25'()));

但我不断收到此错误消息:

命令行错误:23列:77错误报告-SQL错误: ORA-00917:缺少逗号 00917. 00000-“缺少逗号” *原因:
*动作:

1 个答案:

答案 0 :(得分:0)

语句末尾有多余的括号是没有意义的。我还建议对列date_added使用显式的文本日期,而不要依赖隐式转换(当然,假设此列的数据类型为date)。

所以:

INSERT INTO Products_mgs (
    product_id, 
    category_id, 
    product_code, 
    product_name, 
    description, 
    list_price, 
    discount_percent, 
    date_added
) VALUES (
    11, 
    4, 
    'YDP162R', 
    'Yamaha Arius YDP162R Traditional Console Style Digital Piano',
    'The best keyboard on the market. Offers excellent sound rendering that truly separates it from the rest of the pack.',
    1599.99,
    10,
    DATE '2020-10-25'   --> literal date
);  -- trailing parentheses removed