简体   繁体   中英

ORA-00917: Missing Comma SQL Oracle error

I am using Oracle SQL and have just altered a table and added a column named Date_Employed

ALTER TABLE Employees ADD Date_Employed date;

My problem is that whenever I try to insert a value into the Date_Employed column i get an error ORA-00917: Missing comma when I type in the code below

INSERT INTO Employees(Date_Employed) VALUES (26 September 2001);

I would like to know whether the method I am using to try to input data into the column is correct? and if it is not, what is the correct way to insert date data into the column?

Also, I would like to know, why I am getting the error I described?

Use a proper date format for Oracle and enclose it in single quotes:

INSERT INTO Employees(Date_Employed)
    VALUES (DATE '2001-09-26');
INSERT INTO 
Employees (Date_Employed) 
VALUES 
(TO_DATE('2003/05/03 21:02:44', 'yyyy/mm/dd hh24:mi:ss'));

You are getting error because oracle is not able to understand the date format you have given.

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