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

Alternative way to access a field in a %ROWTYPE variable

From: "Ismael (dot)(dot)(dot)(dot)" <ismaelpsp(at)hotmail(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Alternative way to access a field in a %ROWTYPE variable
Date: 2008-07-30 19:54:53
Message-ID: BLU103-W3DA52E8B58BB3C26F345DA37D0@phx.gbl (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Is there another way to access to the field in a variable of type record?

I need to store the name of a field in a variable and access
the field whose name matches the content of the variable.

Just as an example of what I want to do, the table or view "pg_user "
has at least the field usename, usesysid, valuntil

So I need to access the fields in a way similar to this
row pg_user%ROWTYPE;
field VARCHAR';

field = 'usename';
row.field = 'name';
field = 'usesysid';
row.field = 0;
field = 'valuntil':
row.field = 'who knows';

Is it possible to do something like that?
because that example doesn't work

I'm using plpgsql;

tanks in advance
Plug&Play te trae en exclusiva los mejores conciertos de la red 

pgsql-general by date

Next:From: EXT-Rothermel, Peter MDate: 2008-07-30 20:16:35
Subject: Declaring constants in SQL
Previous:From: Alvaro HerreraDate: 2008-07-30 19:32:32
Subject: Re: Error 10061

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