From: Josh Berkus <josh@agliodbs.com>
To: James Cooper <jim@luckydigital.com>
To: sql <pgsql-sql@postgresql.org>
Subject: Re: syntax question
Date: Sun, 23 Feb 2003 14:52:00 -0800
Message-ID: <200302231452.00484.josh@agliodbs.com> (raw)
In-Reply-To: <006401c2db87$fc09be00$c900a8c0@jax>
References: <006401c2db87$fc09be00$c900a8c0@jax>
James,
> FOR total IN EXECUTE subquery LOOP
>
> END LOOP;
>
> RETURN total.tot;
The above is fine, except that you need to assign total.tot to a variable
*inside* the loop:
FOR total IN EXECUTE subquery LOOP
return_total := total.tot;
END LOOP;
RETURN return_total;
This is because the expression "total.tot" is out of scope as soon as the loop
exits.
--
Josh Berkus
Aglio Database Solutions
San Francisco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, jim@luckydigital.com
Subject: Re: syntax question
In-Reply-To: <200302231452.00484.josh@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox