Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

like keyword in sql  RSS feed

 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey guys

iam using mysql
i need to pass a string to the LIKE keyword in sql

like below shown

select * from person where username LIKE "BAGANAN'S"

BUT THE SINGLE QUOTE IN BAGANAN'S THE QUERY GIVES ME PROBLEM

REGARDS
AMIR
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36396
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amir,
If you are using JDBC, you could use a prepared statement. If you are using raw SQL directly to Oracle, you need to use an escape character. This tells Oracle to use a special character (backslashes are common) to give the single quote special meaning.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!