Re: syntax question

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: syntax question
Дата
Msg-id 200302231452.00484.josh@agliodbs.com
обсуждение исходный текст
Ответ на syntax question  ("James Cooper" <jim@luckydigital.com>)
Список pgsql-sql
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 LOOPreturn_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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "James Cooper"
Дата:
Сообщение: syntax question
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: SQL Statements question, why I get errors...