Derrick Betts <list@blueaxis.com> schrieb:
>
> I have the following in a plpgsql function:
>
> DECLARE
> rec RECORD;
>
> BEGIN
> FOR rec IN EXECUTE 'SELECT * FROM '||table[1]
> LOOP
> --use the results here
> END LOOP;
>
> How can I determine the actual field name and the field value for the record
> variable (rec) if I were to look in index 1 or 2 or 3 of the variable?
Unfortunately you can't access to row-index, you need the name of the
column. You can do a select on information_schema.columns to retrieve
the column-names:
select column_name from information_schema.columns where table_name = ...
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°