i.e f_name entries became the columns of the table & f_value become the rows
I research on crosstab function but i don'e think it is useful because we have to give column names in the command. I want to show it dynamically . I try to create a procedure & also attach it.
A user enters only c_id & output is shown fore.g if a user enters c_id 1 then output is
c_id c1 c2 1 d1 d2
I show the data in simple way bt there r 10000 of rows & 100 of c_id's.
Please let me know if it is possible or any information is required.
Thanks
create function user_news_new(text) returns void as $$ declare name text; cat_name alias for $1; begin CREATE TEMPORARY TABLE temptest(category_id INTEGER,category_name text); /* create a temp table to hold all the dynamic schemas*/ for name in select label_name from category_new where category_id = (select category_id from category where category_name=cat_name) loop execute 'alter table temptest add column ' || name || ' text'; end loop; end; $$ language plpgsql;