Chris Wendel
Chris Wendel

Reputation: 3

Oracle Missing Comma

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

Answers (3)

ravi chaudhary
ravi chaudhary

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

Lalit Kumar B
Lalit Kumar B

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

1010
1010

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

Related Questions