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

Re: How to dynamically call a column in plpgsql

From: Sigurdur Helgason <shelgason(at)yahoo(dot)com>
To: "Henshall, Stuart - Design & Print" <SHenshall(at)westcountry-design-print(dot)co(dot)uk>,pgsql-novice(at)postgresql(dot)org
Subject: Re: How to dynamically call a column in plpgsql
Date: 2002-10-28 13:12:19
Message-ID: 20021028131219.59542.qmail@web41013.mail.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-novice
 --- "Henshall, Stuart - Design & Print"
<SHenshall(at)westcountry-design-print(dot)co(dot)uk> skrev: >
[previous stuff cut]
> I think something like the following should do:
> SELECT INTO cl_nm cons_col FROM constrait_1 WHERE
> ..........
> EXECUTE ''SELECT * FROM tbl WHERE '' ||
> quote_ident(cl_nm) || ''=.......'';
> the plpgsql docs contain more docs for EXECUTE (such
> as when to use
> quote_ident)
> hth,
> - Stuart
>  
Thanks Stuart, but either I am very tired today, or
you must have misunderstood me or my original question
was poorly phraised. Since I fail to see how your
answer helps me to access the 'cons_col' value in the
NEW record?

--
Say for example that NEW contains 3 columns: val1,
val2, val3

In contraints table the value of cons_col culumn
contains a string (either val1, val2 or val3).

if cons_col == "val1" I would like to read the
NEW.val1 value into a variable.

Regards
/Siggi


_____________________________________________________
Gratis e-mail resten av livet på www.yahoo.se/mail
Busenkelt!

In response to

pgsql-novice by date

Next:From: Pam WamplerDate: 2002-10-28 13:34:17
Subject: Re: show all tables?
Previous:From: Henshall, Stuart - Design & PrintDate: 2002-10-28 12:48:33
Subject: Re: How to dynamically call a column in plpgsql

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