简体   繁体   中英

Oracle - ORA-00917: missing comma

INSERT INTO contact(id, org_name, street_address1, street_address2,  
   city, state, postal_code, country_code, last_name, first_name,
   person_title, phone_country_code, phone_area-code, phone_number, email, created_time)
VALUES(20, 'cognizant', 'chennai', 'ckc',
   'tamilnadu', '092345', '0934', 'Edwin', 'Michael',
   'MR', 09, 10, '0924242', 'edwin@seic.com', 09824);

When I am trying to execute the code above, I'm getting the error below:

ERROR at line 1: ORA-00917: missing comma

  • i think the column name phone_area-code is phone_area_code (a hyphen can not be used for a column name)
  • the last value should be quoted as '09824' which's non-integer as having a leading zero
  • the values list has 15 items, while column names list has 16 .

You are missing the value for the state . If you don't have a value for it, you must pass it as empty string '' or NULL :

INSERT INTO contact(id, org_name, street_address1, street_address2,  
   city, state, postal_code, country_code, last_name, first_name,
   person_title, phone_country_code, phone_area-code, phone_number, email, created_time)
VALUES(20, 'cognizant', 'chennai', 'ckc',
   'tamilnadu', '', '092345', '0934', 'Edwin', 'Michael',
   'MR', 09, 10, '0924242', 'edwin@seic.com', 09824);

Your column count 16 but your data that you inserted only 15. You missing one value there, just put single quote '', for the missing value or the value that you dont want to input anything.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM