adressing column

From: Stefan Leitich <steffn(at)gmx(dot)at>
To: pgsql-novice(at)postgresql(dot)org
Subject: adressing column
Date: 2003-10-01 10:13:59
Message-ID: 3F7AA8E7.5080700@gmx.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

i have the following function:

declare
prim_col_name Alias for $1;
prim_col_val Alias for $2;
my_column Alias for $3;
link_table Alias for $4;
link_col Alias for $5;
data_table alias for $6;
my_record Record;
result_string varchar;
i integer;
begin
result_string := '';
i := 0;
For my_record in execute 'select ' || my_column || ' from ' ||
data_table || ' where ' || link_col || ' in (select ' || link_col || '
from ' || link_table || ' where ' || prim_col_name || ' = ' ||
prim_col_val || ') order by lower(' || my_column || ')' loop
if i = 0 then
result_string := my_record.col;
else
result_string := result_string || ', ' || my_record.col;
end if;
i := i + 1;
end loop;
return result_string;
end

now i am searching for a way, to access my_column in my_record (now it
just works if my_column = 'col')
can anyone help please!
thanx
steffn

Browse pgsql-novice by date

  From Date Subject
Next Message Stefan Leitich 2003-10-01 11:23:46 adressing columns
Previous Message paul 2003-10-01 09:14:27 Re: SELECT syntax question - combining COUNT and DISTINCT