Possible Duplicate:
how to pass a variable in WHERE IN clause of oracle sql?
I have a column Prefix in my table Tbl_Prefix with value as string separated by comma like this:
'aaa','bbb','ccc'
I have an employee table Tbl_Employee like this:
Empno Prefix
------------
1000 aaa
2000 eee
3000 ccc
4000 aaa
5000 ddd
I need to use this prefix in the IN portion of my WHERE clause in this query:
Select *
from Tbl_Employee
where Tbl_Employee.Prefix in (select Tbl_Prefix.prefix
from Tbl_Prefix
where Tbl_Prefix.flag = 'y')
The inner select query select Tbl_Prefix.prefix from Tbl_Prefix where Tbl_Prefix.flag='y' has the result 'aaa','bbb','ccc'
How to use this string in the 'IN' clause so that I will get a proper result?