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

plpgsql - accessing fields of record type

From: Szálka Tamás <rontombontom(at)freestart(dot)hu>
To: pgsql-sql(at)postgresql(dot)org
Subject: plpgsql - accessing fields of record type
Date: 2004-09-26 16:15:57
Message-ID: 4156EB3D.3070805@freestart.hu (view raw or flat)
Thread:
Lists: pgsql-sql
Hi!

I'd like to ask whether it is possible to access fields of record type 
variable in plpgsql in the following way:

I have a table with field named "XY_1", "XY_2", ... "XY_255".
I want to access the values in the table from a plpgsql function somehow 
in a loop with the iterative variable. Can I address the appropriate   
''XY_'' || loopvariable    field with the help of the loop variable?
If I can, what is the syntax of this? Sorry, I've read through the 
documentation, but haven't find any solution.

I have thought of an alternative solution: can plpgsql convert a record 
type into array? (Then I could address the field value with the nth 
element of the array)

Thanks for your help

tomasz

Responses

pgsql-sql by date

Next:From: Michael FuhrDate: 2004-09-26 18:33:43
Subject: Re: plpgsql - accessing fields of record type
Previous:From: Ian HardingDate: 2004-09-24 21:49:56
Subject: Re: [SQL] need ``row number``

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