Re: SQL works but same function is confused - Mailing list pgsql-general

From Adrian Klaver
Subject Re: SQL works but same function is confused
Date
Msg-id 533B7777.3000403@aklaver.com
Whole thread Raw
In response to Re: SQL works but same function is confused  ("Bui, Michelle P" <michelle.p.bui@boeing.com>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: SQL works but same function is confused
Next
From: Andrew Sullivan
Date:
Subject: Re: simple update query stuck