23ai: Having with alias

Within the Oracle database 23ai, we can use an alias in the HAVING clause,

With Oracle 19c:

SQL> select * from tb2;

ID NAME2
---------- --------------------
1 Daouehi 01
2 Daouehi 02

SQL>
SQL> select count(*) i from tb2 having i > 0;
select count(*) i from tb2 having i > 0
*
ERROR at line 1:
ORA-00904: "I": invalid identifier


SQL>

With Oracle 23ai:

SQL> select * from tb2;

ID NAME2
---------- --------------------
1 Daouehi 01
2 Daouehi 02

SQL>
SQL>
SQL> select count(*) i from tb2 having i > 0;

I
----------
2

SQL>

Enjoy!

Bookmark the permalink.
Loading Facebook Comments ...

Leave a Reply