Re: why the query is not failing the syntax check

From: Mohamed Houri <mohamed.houri_at_gmail.com>
Date: Wed, 21 Sep 2022 13:51:20 +0200
Message-ID: <CAJu8R6hAYnHvJojjCt44xJGuPSYVH2_VLpRwkAa-g2MUKkZ45w_at_mail.gmail.com>



Hello

You should always alias your subquery

SQL> select * from dba_users where username in (select distinct a.username from sys.aud$ a);
select * from dba_users where username in (select distinct a.username from sys.aud$ a)

                                                           *
ERROR at line 1:
ORA-00904: "A"."USERNAME": invalid identifier

Best regards
Mohamed

Le mer. 21 sept. 2022 à 13:42, Laurentiu Oprea <laurentiu.oprea06_at_gmail.com> a écrit :

> Hello everyone,
>
> I have a strange one (at least for me), why the next query is not failing
> because column username does not exist in aud$?
>
> select * from dba_users where username in (select distinct username from
> sys.aud$);
>
> Thanks a lot.
>

-- 

Houri Mohamed

Oracle DBA-Developer-Performance & Tuning

Visit My         - Blog <http://www.hourim.wordpress.com/>

Let's Connect -
<http://fr.linkedin.com/pub/mohamed-houri/11/329/857/>*Linkedin
Profile <http://fr.linkedin.com/pub/mohamed-houri/11/329/857/>*

My Twitter <https://twitter.com/MohamedHouri>      - MohamedHouri
<https://twitter.com/MohamedHouri>

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Sep 21 2022 - 13:51:20 CEST

Original text of this message