Re: Can I use an alias name is a where clause

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 10 Mar 2005 00:22:35 +0100
Message-ID: <r61v21p9e5bee08jsruokg6e2rnn6mprsb_at_4ax.com>


On Wed, 09 Mar 2005 23:02:47 +0000, Lig <lignite_at_iol.ie> wrote:

>The following select statement yeilds an error message ORA-00904:
>"Total": invalid identifier.
>
> select t.a + t.b + t.c Total
> from some_table t
> where Total > 0
>
>Why can't the alias Total be used in the Where clause?

That's just how it works.
>
>Is there any workaround other than doing something horrible like below
>
> select *
> from (select t.a + t.b + t.c Total
> from some_table t)
> where Total > 0
>

Why do that? You can cut and paste, can you?
>
>
>Cheers
>Lig

Please do not cross post to all groups you can spell. All groups are monitored and answered by the same small group of people. You're wasting both bandwith and people's time.

--
Sybrand Bakker, Senior Oracle DBA
Received on Thu Mar 10 2005 - 00:22:35 CET

Original text of this message