aspose file tools*
The moose likes Oracle/OAS and the fly likes like keyword in sql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "like keyword in sql" Watch "like keyword in sql" New topic
Author

like keyword in sql

Amirtharaj Chinnaraj
Ranch Hand

Joined: Sep 28, 2006
Posts: 236
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30541
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
jQuery in Action, 2nd edition
 
subject: like keyword in sql