2 Replies - 6777 Views - Last Post: 09 November 2013 - 06:47 AM

#1 young2daniel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 42
  • Joined: 29-December 07

Missing comma error in Oracle SQL Developer

Posted 09 November 2013 - 06:21 AM

Hey guys,

I need to insert a value O'Donald in a table in Oracle. I already created the query, which would prompt the user for all the values, but I'm having errors when I enter O'Donald in the substitution variable. SQL developer gives me "missing comma" error.

However, if I enter just ODonald in the substitution variable field, it executes the query appropriately.

Any ideas on what to do?

Thanks

Here's the query:

INSERT INTO my_employee (id, last_name, first_name, userid, salary)
VALUES (&id, '&last_name', '&first_name', lower(substr('&last_name', 1, 6) || substr('&first_name', 1, 1)), &salary);



Is This A Good Question/Topic? 0
  • +

Replies To: Missing comma error in Oracle SQL Developer

#2 Peter O  Icon User is offline

  • D.I.C Regular

Reputation: 128
  • View blog
  • Posts: 299
  • Joined: 19-October 13

Re: Missing comma error in Oracle SQL Developer

Posted 09 November 2013 - 06:36 AM

You have to use two ' characters, otherwise it will be treated as the end of the string: O''Donald
Was This Post Helpful? 1
  • +
  • -

#3 young2daniel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 42
  • Joined: 29-December 07

Re: Missing comma error in Oracle SQL Developer

Posted 09 November 2013 - 06:47 AM

View PostPeter O, on 09 November 2013 - 06:36 AM, said:

You have to use two ' characters, otherwise it will be treated as the end of the string: O''Donald


Oh, thanks Peter. It worked perfectly!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1