I have the following query
select * from table_1
where Conditions in
(select case when check_condition = 'Y' then 'Condition_1'
else 'N/A' end as Check_condition
from table_2
WHERE id = 1122)
where table_1 contains the values in column Conditions as follows.
Condition_1,Condition_2
This works fine and return me the results.
i want to use multiple select statements inside the in clause and I did it as below.
select * from table_1
where Conditions in (
select ''''||
(select case when check_condition = 'Y' then 'Condition_1'
else 'N/A' end as Check_condition
from table_2
WHERE id = 1122)||''''||','''||
(select case when check_condition = 'Y' then 'Condition_2'
else 'N/A' end as Check_condition
from table_2 WHERE id = 1122)||''''
from dual
)
inner query ( inside the in clause) giving me the correct results as expected -
'Condition_1','Condition_2'
and when I copy paste it to the parent query it works fine and show the results.
select * from table_1 where Conditions in ('Condition_1','Condition_2')
My issue is, it is not giving any results when I used the second query. I know that sub query will return the results that should match the rows in the outer query. But it shows me empty result set.
I am using oracle 11g
Can anyone please help me out.. Thank you all in advance.