I have three exactly same sql queries. However, one of them does not return any results. I couldn't find proper explaination for the issue.
Anyone who can
--returns one result
SELECT col1
FROM table1
WHERE col1 not IN
(select x.hesno from (SELECT c1||c2||c3 FROM Table2 S) x) ;
--returns no result
SELECT col1
FROM table1
WHERE col1 not IN
(SELECT c1||c2||c3 FROM table2) ;
--returns one result
SELECT col1
FROM Table1
WHERE NOT EXISTS (
SELECT 1 FROM table2 WHERE c1||c2||c3 = col1
);
Here is the table descriptions
Table1
Name Null? Type
------ ----- -------------
COL1 VARCHAR2(15)
Table2
Name Null? Type
--------------- ----- -------------
C1 VARCHAR2(2)
C2 VARCHAR2(3)
C3 VARCHAR2(10)