I have a query like this
SELECT *
FROM Table_Name
WHERE Category !='0'
AND To_Char(Category) like to_char(:paramCategory)
I want to implement a wild card search with this category value. When I give value as 9, no problem, I get the expected result.
But when I give use %9 or 9% or %9% as value of category, none of this gives the desired result. e.g. It gives all the result where category starts with 9.. but omit the result as 99,59,209 etc. What is going wrong and how can I solve it?
The table has many other columns but this category is number type. please don’t suggest to change the data_type of this field.
Thanks in advance for the suggestions.
Using
%9%should give you all. Look at the SQL FiddleResults are all rows.