Current Position:Home > Exclude "*" in Like operator

Exclude "*" in Like operator

Update:10-11Source: network consolidation
Advertisement
Hi All,
I am trying to use like operator for an output data which has "*" appended at the end.
For example, following is the Place_ID which i have data in a table
12190101*
12349021
12347284
12598992*
When i provide search criteria as "1234" in my application, my query is making the condition as
Place_ID Like "1234%"
But unfortunately it is giving 4 rows as output which is not considering the values which is appended with '*".
I tried making use of the following, but still this is not working.
Place_ID Like "1234%" ESCAPE '*'
Can someone suggest me where i am doing wrong.
Thanks,
Prakash

The Best Answer

Advertisement
Prakash wrote:
But unfortunately it is giving 4 rows as output which is not considering the values which is appended with '*".It is not clear what output you expect. But one thing is for sure: condition Place_ID Like 11234%' can't return 4 rows:
{code}
with data as(
select '12190101*' place_id from dual union all
select '12349021' from dual union all
select '12347284' from dual union all
select '12598992*' from dual
select place_id
from data
where place_id like '1234%'
PLACE_ID
12349021
12347284
SQL>
{code}
So post desired results.
SY.