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