Re: SQL works but same function is confused

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: SQL works but same function is confused
Дата
Msg-id 533B7777.3000403@aklaver.com
обсуждение исходный текст
Ответ на Re: SQL works but same function is confused  ("Bui, Michelle P" <michelle.p.bui@boeing.com>)
Список pgsql-general
On 04/01/2014 06:44 PM, Bui, Michelle P wrote:
> v_status is not used inthe SQL statement but is used in the function because we need to return a table (catgory,
tool_count,status). 
>
> Even when I did not use v_status, and assign value 'valid' or 'invalid' to the output parameter directly, the same
erroroccurred. 

Not use v_status where, in the DECLARE block or as an alias in the query?

If it where me and I wanted to keep the variable in the DECLARE block I
would do:

DECLARE

_v_status TEXT;

At least you would be able to track which variable is in play.


 > Can we assign value for an alias in a function?

An SQL alias for table, column, etc or an alias for a function argument?

http://www.postgresql.org/docs/9.3/interactive/plpgsql-declarations.html#PLPGSQL-DECLARATION-ALIAS

>
>   Thanks,
> Michelle




--
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SQL works but same function is confused
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: simple update query stuck