Wednesday 25 September 2013

String Comparison in WHERE clause

1) An easier solution is to use INSTR:

Assume  :P5_USER_ID_LIST = ' ,45,4932,20,19,'
SELECT * FROM users u 
WHERE instr(',' || :P5_USER_ID_LIST ||',' ,',' || u.user_id|| ',', 1) !=0;

Tricks:
',' || :P5_USER_ID_LIST ||',' to make your string ,45,4932,20,19,
',' || u.user_id|| ',' to have i.e. ,32, and avoid to select the 32 being in ,4932, 

No comments:

Post a Comment

Universal Theme - Side Navigation Menu Child Entry Icon Alignment

Hi, There is an issue with the Side Navigation Menu Child Entry Icon Alignment in Universal theme if you are using APEX 5.1 or prior vers...