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

Re: Column names as variables in plpgsql

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Column names as variables in plpgsql
Date: 2006-07-03 05:00:04
Message-ID: 20060703050003.GA4905@webserv.wug-glas.de (view raw or flat)
Thread:
Lists: pgsql-novice
am  30.06.2006, um 16:32:38 -0600 mailte Derrick Betts folgendes:
> Is it possible to assign a column name to a variable and then use that 
> variable in a SELECT statement inside a function using plpgsql?

Yes. You can define a string with your SQL, including variables. Thena
you can EXECUTE this string.

http://www.postgresql.org/docs/8.1/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN


HTH, Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    === 

In response to

Responses

pgsql-novice by date

Next:From: Derrick BettsDate: 2006-07-03 17:50:11
Subject: Re: Column names as variables in plpgsql
Previous:From: Guido BarosioDate: 2006-07-03 04:20:39
Subject: Re: Password Help?

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