Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Subquery Issue

KarmaYogiJul 14 2017 — edited Jul 17 2017

I have two tables . Details Below:

desc test

Name                                      Null?    Type

----------------------------------------- -------- ----------------------------

AA                                                 VARCHAR2(10)

BB                                                 VARCHAR2(10)

desc test1

Name                                      Null?    Type

----------------------------------------- -------- ----------------------------

CC                                                 VARCHAR2(10)

DD                                                 VARCHAR2(10)

select * from test;

AA         BB

---------- ----------

aa1        bb1

aa2        bb2

aa3        bb3

aa4        bb4

select * from test1;

CC         DD

---------- ----------

cc1        dd1

What I Observed

==================

When i try to query from TEST table using a SUBQUERY output from TEST1 without an non exisitng coulum  in TEST2  it gives me output. However it should throws me error.

-----------AA column no exisitng in TEST1

select * from TEST where AA in (select AA from TEST1);

AA         BB

---------- ----------

aa1        bb1

aa2        bb2

aa3        bb3

aa4        bb4

-----------BB column no exisitng in TEST1

select * from TEST where BB in (select BB from TEST1);

AA         BB

---------- ----------

aa1        bb1

aa2        bb2

aa3        bb3

-----------This is expected.

select * from TEST

  where AA in (select AAA from TEST1);

where AA in (select AAA from TEST1)

                     *

ERROR at line 2:

ORA-00904: "AAA": invalid identifier

Can anyone let me know what is the issue here. Let me know more clarification needed.

Thanks

KY

This post has been answered by JohnWatson2 on Jul 14 2017
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 14 2017
Added on Jul 14 2017
4 comments
209 views