Wednesday 15 September 2010

Perform SQL query using LIKE with bind variables

Recently, I have been searching how to use "like" with bind variables in APEX and I came up with following:

select first_name, last_name
from user_details
where
(first_name like '%'|| :P1_USER||'%' or last_name like '%'|| :P1_USER||'%' )
and status='student'

It is up to you how you want to use % (at the beggining or at the end).

No comments:

Post a Comment