File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
JDBC and Relational Databases
How to use underscore as literal not as wild char
Joined: Jan 02, 2012
Aug 10, 2012 20:59:00
I'm using oracle and need to use the underscore as literal not as wild char in qurery
I found on the internet something like this
SELECT SAMPLE_NAME FROM SAMPLES WHERE SAMPLE_NAME LIKE 'ABC\_XYZ' ESCAPE '\'
and if there is SAMPLE_NAME equales ABC_XYZ it will be feached
but in my case the
that i compare to is variable(entred by user)
select SAMPLE_NAME FROM SAMPLES WHERE SAMPLE_NAME LIKE ?
Is there any way to disable using '_' as wildchar in general in queris???
or the only solution is to process user input before using it in LIKE statement !
thanks in advance
Joined: Oct 14, 2005
Aug 10, 2012 21:17:53
That looks like it's a duplicate of this post:
... so let's keep that as the active thread and close this one.
I agree. Here's the link:
subject: How to use underscore as literal not as wild char
using wildcards literally in queries
Fetching values from the database
Get dialect from session (for character escaping)
problem in generating query in MSAccess
selecting special characters
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015