0

i have the following query for inserting values into my Customer table:

INSERT INTO customer(Booking_id,First_name,Last_name,Phone,Address,Town,Postcode,email) 
VAlUES
(1,'Elroy','Craddock',01497 3139773','36 Yaffingale Gate','Tadley','RG78 2AB','[email protected]')

after running it writes

Error starting at line 1,551 in command:
INSERT INTO customer (Booking_id, First_name, Last_name, Phone,  Address, Town, Post code, email) VALUES(   1551    ,'  Leonard ',' Babbs   ',  01959 8159688   ,'  46 Zoophagy Green   ',' Choppington ',' NE41 5DB    ',' [email protected] ')
Error at Command Line:1,551 Column:86
Error report:
SQL Error: ORA-00917: missing comma
00917. 00000 -  "missing comma"
*Cause:    
*Action:

i'v been trying to fix this syntax error for almost a day now! Any help/suggestions are appreciated! Thank you

3 Answers 3

4

This is your query:

INSERT INTO customer (Booking_id, First_name, Last_name, Phone,  Address, Town, Post code, email) VALUES(   1551    ,'  Leonard ',' Babbs   ',  01959 8159688   ,'  46 Zoophagy Green   ',' Choppington ',' NE41 5DB    ',' [email protected] ')

Your problem is here: 01959 8159688. This is an invalid number literal.

Depending on Phone column type, it's got to be: '01959 8159688' (if it is a text column), or 01959.8159688 (if it is a numeric column).

Sign up to request clarification or add additional context in comments.

Comments

2

The problem is with 01959 8159688. Assuming this is a phone number, and you want to keep the space in order to separate the area code from the rest of the number, you should surround it with single quotes: '01959 8159688' - otherwise, it's interpreted as two unrelated numeric literals.

Comments

0

My suggestion is to format your queries like this:

insert into yourtable (
field1
, field2
, etc
)
values (
value1
, value2
, etc
)

It makes the commas more visible. It also makes counting easier since you need the same number of fields and values. Finally, it makes commenting easier if you need to find a problematic part of your query.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.