Re: Variable column name - Mailing list pgsql-general

From Bob Pawley
Subject Re: Variable column name
Date
Msg-id 69597773E704449891C6CA5267B2DD6D@BobPC
Whole thread Raw
In response to Re: Variable column name  (Bill Moran <wmoran@potentialtech.com>)
Responses Re: Variable column name
Re: Variable column name
Re: Variable column name
List pgsql-general

-----Original Message-----
From: Bill Moran
Sent: Thursday, September 01, 2011 7:59 AM
To: Bob Pawley
Cc: Postgresql
Subject: Re: [GENERAL] Variable column name

In response to "Bob Pawley" <rjpawley@shaw.ca>:
>
> I want to add information to multiple columns (20 – 40) by employing a
> loop. Each pass of the loop will populate one column with an array.
>
> I have tried and I have read that variables can not be used to control
> column names.
>
> Is there a means of working around this restriction other than creating 20
> to 40 hard coded statements??

You can generate dynamic SQL statements with plpgsql.

Would it be possible for you to point me to an example??

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/


pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: Variable column name
Next
From: Scott Ribe
Date:
Subject: Re: Variable column name