This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes How to use underscore as literal not as wild char Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Reply locked New topic

How to use underscore as literal not as wild char

cute nonni

Joined: Jan 02, 2012
Posts: 7
Hello dears,

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

and if there is SAMPLE_NAME equales ABC_XYZ it will be feached

but in my case the string that i compare to is variable(entred by user)

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
Paul Clapham

Joined: Oct 14, 2005
Posts: 19719

That looks like it's a duplicate of this post: so let's keep that as the active thread and close this one.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: How to use underscore as literal not as wild char
It's not a secret anymore!