sqloracleinsert-statement

SQL Error: ORA-00917: missing comma 00917. 00000 - "missing comma" *Cause: *Action:


I'm trying to add a new row to a Products table with this:

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'()));

but I keep getting this error message:

Error at Command Line : 23 Column : 77 Error report - SQL Error: ORA-00917: missing comma 00917. 00000 - "missing comma" *Cause:
*Action:


Solution

  • There are extra parentheses at the end of the statement that make no sense. I would also recommend using an explicit literal date for column date_added rather than relying on implicit conversion (assuming, of course, that this column is of date datatype).

    So:

    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