Hi,
I'm new to PL so sorry if it shows with the post :). I'm trying to do a
case and accent insensitive search in Apex without using
upper and
lower functions. I've found
nlssort to solve this but I'm not sure if I'm doing something wrong or it can't be done.
nlssort works fine when used like this:
select *
from Items_V
where nlssort(Name,'nls_sort=spanish_ai') like (nlssort(:P5_Name,'nls_sort=spanish_ai'))
what I also need is results that contain the
Name and on top of that a
case in the
where clause.
The following code is what I have now and _where I want to include the
nlssort_. It returns all items matching or containing
P5_Name and
Null values.
select *
from Items_V
where ((Name like (case when to_char(:P5_Sel)='1' then nvl('%'||:P5_Name||'%','%' )
else '%' end)
and Name is not null)
or ((case when to_char(:P5_Sel)='1' then nvl('%'||:P5_Name||'%','%' )
else '%' end) ='%' and Name is null))
I've tried many ways but I just can't get the combination right and don't really know where it should go. Trying a more simple approach to start with, I found that concatenating +'%'+ to the
nlssort(:P5_Name,'nls_sort=spanish_ai') wasn't returning items that contained, only items that matched.
Thank you in advance,
Marc
BTW, I'm developing on:
DB 11g
Application Express 3.1.1.00.09