File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 30050
    
149

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: like keyword in sql
 
Similar Threads
Enumeration mapping doesn't work in JPA
How to use the keyword for searching?
Get date List between two dates in mysql
Pagination in Servlets from a Resultset
Group by in mysql