In our application Oracle(11g and 12C), I'm facing a weird Issue as below.
When I run the below query in Oracle DB it runs successfully and gives me output.
select * from table1 where col1 in (select col2 from table2 ) ;
But when I run the below inner query alone it throws the error:
select col2 from table2 ORA-00904: "COL2": invalid identifier
When I described the table table2, Col2 is not there. The error is expected. But the previous query executes successfully which is my concern.Could some one explain me this behavior?