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 01:41:19
Message-ID: BANLkTi=2Ku8Y1pGe6UCgKz6QG2cixFjAaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shigeru Hanada 2011-06-29 02:08:28 Re: FOREIGN TABLE with dblink
Previous Message Rob Sargent 2011-06-29 00:43:53 Re: PL/PGSQL - dynamic variable names