This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC 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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

How to use underscore as literal not as wild char

cute nonni
Greenhorn

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
Bartender

Joined: Oct 14, 2005
Posts: 18716
    
    8

That looks like it's a duplicate of this post: http://www.coderanch.com/t/589575/JDBC/databases/underscore-as-literal-not-as... so let's keep that as the active thread and close this one.
 
Consider Paul's rocket mass heater.
 
subject: How to use underscore as literal not as wild char