Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Experts need sql help.

Experts need sql help.

From: Manasa Rao <rao_manasa_at_hotmail.com>
Date: Wed, 20 Dec 2000 14:24:39 -0000
Message-Id: <10716.125003@fatcity.com>


Hello all,
  I have two tables test1 and reporting_org. I have the structure and test values below. When I do the following query it selects no rows. But I do it separately it gives me the correct value. So, question is can I put a select statement within left side of the where clause. I have always done it on the other side, like a sub-query. Folks, please tell me if anyone tried placing a select stmt on the left side of the where clause.
Thanks for all your help.
Manasa.

09:18:11 SQL> SELECT PFC_CODE FROM REPORTING_ORG
09:18:20   2   WHERE  (SELECT COLUMN_NAME
09:18:20   3             FROM TEST1
09:18:20   4            WHERE TEST1.OID = 2) =  'PFC2';

no rows selected

09:03:23 SQL> DESC TEST1;

Name                                      Null?    Type

----------------------------------------- --------
----------------------------
OID NUMBER(3) TABLE_NAME VARCHAR2(30) COLUMN_NAME VARCHAR2(30) 09:17:52 SQL> DESC REPORTING_ORG; Name Null? Type
----------------------------------------- --------
----------------------------
DIST_CODE VARCHAR2(20) PFC_CODE VARCHAR2(20)

09:17:59 SQL> SELECT * FROM TEST1;

       OID TABLE_NAME                     COLUMN_NAME
---------- ------------------------------ ------------------------------
         1 REPORTING_ORG                  DIST_CODE
         2 REPORTING_ORG                  PFC_CODE

09:18:04 SQL> SELECT * FROM REPORTING_ORG; DIST_CODE PFC_CODE

-------------------- --------------------
NC2                  PFC2


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com Received on Wed Dec 20 2000 - 08:24:39 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US