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,
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