Reputation: 3
I have been working at this for hours and I cannot figure out what is wrong...
I have written this code
INSERT INTO Agents (ID,Name,Phone,Cert_Level,Join_Date) VALUES (1,’Chris’,’317-9578’,1,’01-NOV-91’);
and I get the same missing comma error over and over and I cannot find the problem PLEASE HELP ME
here is the database and I have confirmed that it was created correctly
Agents :
ID Int Primary key
Name Char(10) Not Null
Phone Char(9) Not Null
Cert_Level Int Restricted to values 1-10
Join_Date Date
Upvotes: 0
Views: 3787
Reputation: 625
try the below code as you are different quotes, replace ’ to ' .
INSERT INTO Agents (ID,Name,Phone,Cert_Level,Join_Date) VALUES (1,'Chris','317-9578',1,'01-NOV-91');
Cheers !!
Upvotes: 3
Reputation: 49112
Even after you correct your angular quotes with single quotes, you will still be in trouble because of the date literal.
The join_date
is a DATE
data type column, so this '01-NOV-91'
is wrong. Since, in Oracle anything between single quotes is considered string. You need to use TO_DATE
to convert it into DATE with proper format mask.
For example : TO_DATE('01-NOV-91', 'DD-MON-RR')
Since you have a two digit year, and we all have seen the Y2K bug, I have user RR
format. Better use YYYY
for year.
Upvotes: 0
Reputation: 1858
Your string literals are delimited with unicode character Right single quotation mark (u+2019) instead of Apostrophe (' u+0027). You can try typing the apostrophes.
’Chris’
vs
'Chris'
Upvotes: 1