问题描述
我正在尝试向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-“缺少逗号” *原因:
*动作:
解决方法
语句末尾有多余的括号是没有意义的。我还建议对列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