Re: Problem with an SQL function - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Problem with an SQL function
Date
Msg-id 20020615012054.X24594-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Problem with an SQL function  (chris.gamble@CPBINC.com)
List pgsql-general
On Fri, 14 Jun 2002 chris.gamble@CPBINC.com wrote:

> Is it possible to define the following in language='SQL' ?
>
> select (69.1 * $1 - $2) as x, (53 * $3 - $4) as y;
> select sqrt(x * x + y * y) as distance;
>
> I was trying to create this but keep getting the error that x does not
> exist...

I don't think you can do it as the above, but for the simple
example above, you can probably make it one query with a
subselect in from.
select sqrt(x*x+y*y) as distance from
 (select (69.1 * $1 - $2) as x, (53 * $3 - $4) as y) as foo;



pgsql-general by date:

Previous
From: Justin Clift
Date:
Subject: Re: Mac os x
Next
From: Jeff Davis
Date:
Subject: Re: Fw: read this and puke