Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SQL quotation question  RSS feed

 
Werner Fletcher
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

I'm trying to insert this into a table from the MySQL command line: Quote for the day: "bla bla bla"
This is the line I'm using: INSERT INTO table VALUES('Quote for the day: '"bla bla bla"'');

This is not working for me... any help?

Thanks
 
Werner Fletcher
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I accidentally clicked the freaking "Solved" button

What I mean is that I'm not getting the " " around my quote.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 36634
475
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't worry about the solved button.

It looks like you have nested single quotes. You need to escape them so the database can see them. In most databases, you write the ' symbol an extra time.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!