Re: [GENERAL] pivot functions with variable number of columns

2012-09-07 Thread Pavel Stehule
2012/9/6 Misa Simic : > Hi Pavel, > > Hm... To me workaround looks as exactly as the same thing? > > 1) uses Dynamic SQL to bulid query (but returns refcursor insted of text) > > 2) client still needs to execute 2 commands (second is fetch instead of > execute 'result') > > However, based on your n

Re: [GENERAL] pivot functions with variable number of columns

2012-09-06 Thread Misa Simic
Hi Pavel, Hm... To me workaround looks as exactly as the same thing? 1) uses Dynamic SQL to bulid query (but returns refcursor insted of text) 2) client still needs to execute 2 commands (second is fetch instead of execute 'result') However, based on your name, and the name of the blog author :

Re: [GENERAL] pivot functions with variable number of columns

2012-09-06 Thread Pavel Stehule
Hello 2012/9/6 Misa Simic : > That is one of most wanted features of PostgreSQL, what is not solved yet,,, > > But it seems will be soon with introductions of Stored Procedures... > I wish :) > For now, you must "know" what result (columns) you expects... > > So the only one option for now is to

Re: [GENERAL] pivot functions with variable number of columns

2012-09-06 Thread Misa Simic
That is one of most wanted features of PostgreSQL, what is not solved yet,,, But it seems will be soon with introductions of Stored Procedures... For now, you must "know" what result (columns) you expects... So the only one option for now is to use Dynamic SQL - to build your query dynamically b

Re: [GENERAL] pivot functions with variable number of columns

2012-09-06 Thread Willy-Bas Loos
a very nice way is to use a cursor. http://okbob.blogspot.cz/2008/08/using-cursors-for-generating-cross.html HTH WBL On Thu, Sep 6, 2012 at 12:40 PM, Vincent Veyron wrote: > Le jeudi 06 septembre 2012 à 00:40 -0700, Chris Travers a écrit : > > > > > > On Wed, Sep 5, 2012 at 10:14 PM, punnoose

Re: [GENERAL] pivot functions with variable number of columns

2012-09-06 Thread Vincent Veyron
Le jeudi 06 septembre 2012 à 00:40 -0700, Chris Travers a écrit : > > > On Wed, Sep 5, 2012 at 10:14 PM, punnoose > wrote: > I want to have a pivot like function in which i should have > variable number > of columns.i went for crosstab but it doesnot support variable >

Re: [GENERAL] pivot functions with variable number of columns

2012-09-06 Thread Chris Travers
On Wed, Sep 5, 2012 at 10:14 PM, punnoose wrote: > I want to have a pivot like function in which i should have variable number > of columns.i went for crosstab but it doesnot support variable number of > columns.Can any body suggest an alternative.like if i have a event at a > particular time of t

Re: [GENERAL] pivot functions with variable number of columns

2012-09-06 Thread Raghavendra
On Thu, Sep 6, 2012 at 10:44 AM, punnoose wrote: > I want to have a pivot like function in which i should have variable number > of columns.i went for crosstab but it doesnot support variable number of > columns.Can any body suggest an alternative.like if i have a event at a > particular time of t

[GENERAL] pivot functions with variable number of columns

2012-09-05 Thread punnoose
I want to have a pivot like function in which i should have variable number of columns.i went for crosstab but it doesnot support variable number of columns.Can any body suggest an alternative.like if i have a event at a particular time of the day like one at 02:35,11:34, then i should have column