Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Problems w/compound SQL statement
Below is an example of a compound SQL statement that returns 0 rows (Example #3) when using tables "QCLINK" and "SAMPHEADER".
Each individual SQL query returns at least one row (Examples 1 &2).
Also below, is an example of a compound SQL statement that returns 1 row (Example #4) when using tables "SAMPHEADER" and "SAMPDATA".
My questions is this: can anyone think of a reason why the compound select statement using the qclink table won't work ???
SQL> SELECT SAMP_JOINID FROM SAMPHEADER WHERE SAMP_JOINID='SJ322977'; SAMP_JOINID
2) Individual SQL statement #2
SQL> SELECT SAMP_JOINID FROM QCLINK WHERE SAMP_JOINID='SJ322977'; SAMP_JOINID
3) Compound SQL Statement using QCLINK in ()
SQL> SELECT SAMP_JOINID FROM SAMPHEADER WHERE SAMP_JOINID IN 2 (SELECT SAMP_JOINID FROM QCLINK WHERE SAMP_JOINID='SJ322977'); no rows selected
4) Compound SQL Statement using SAMPDATA in ()
SQL> SELECT SAMP_JOINID FROM SAMPHEADER WHERE SAMP_JOINID IN 2* (SELECT SAMP_JOINID FROM SAMPDATA WHERE SAMP_JOINID='SJ322977') SAMP_JOINID