Monday, 8 September 2008

using IN LIST in oracle



select * from table_name where cl_id in
(select * from
(select trim( substr(txt,
instr(txt, ',', 1, level) + 1,
instr(txt, ',', 1, level + 1) -
instr(txt, ',', 1, level) - 1)) as token
from (select ',' '1,2,3,4' ',' txt from dual)
connect by level <= length('1,2,3,4') -
length(replace('1,2,3,4', ',', '')) + 1))