In条件中字符串的转换问题
有一个字符串 比如A='a,b,c'
想把它转换成'a','b','c'作为in 的条件
select * from t1 where t1.field in (A)
应该怎么转换?
------解决方案--------------------使用别名,将该表看成是两张表,
select first.A from t1 first ,t1 second where first.A=substr(second.a,0,1) or first.A = substr(second.a,2,1) or first.A = substr(second.a,4,1)
------解决方案--------------------SQL> select regexp_substr('SMITH,ALLEN,WARD,JONES','[^,]+', 1, level) from dual
2 connect by regexp_substr('SMITH,ALLEN,WARD,JONES', '[^,]+', 1, level) is not null;
REGEXP_SUBSTR('SMITH,A
----------------------
SMITH
ALLEN
WARD
JONES