Skip site navigation (1) Skip section navigation (2)

Re: PL/PGSQL - dynamic variable names

From: Ben Carbery <ben(dot)carbery(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: PL/PGSQL - dynamic variable names
Date: 2011-06-29 02:10:32
Message-ID: BANLkTinS=mLUNVHk-jzBZv3aab7D2arYpA@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
Actually there is a section in the manual on this problem:
http://www.postgresql.org/docs/9.0/static/plpgsql-implementation.html#PLPGSQL-VAR-SUBST


On 29 June 2011 11:41, Ben Carbery <ben(dot)carbery(at)gmail(dot)com> wrote:

>
> Hm, "a" isn't a variable,it's the value of stuff[1].
>
>
> It's both..
>
> DECLARE
>     a integer;
>     b integer;
>
> The point is I want a dynamically named variable. Here I've named them the
> same as stuff[i] but they can be anything provided it is a different
> variable name on each loop iteration. The manual is not entirely clear on
> where loop variable substitution does and does not apply with FOR.
>
>
>
>> Did you try
>> declaring a,b,c,d as the return type of the respective functions?
>>
>>
> How would this help?
>

In response to

pgsql-general by date

Next:From: Rob SargentDate: 2011-06-29 02:30:40
Subject: Re: PL/PGSQL - dynamic variable names
Previous:From: Shigeru HanadaDate: 2011-06-29 02:08:28
Subject: Re: FOREIGN TABLE with dblink

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group