From: | Иван Марков <aesthete2005(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Need help to dynamically access to colomns in function! |
Date: | 2008-12-16 20:37:17 |
Message-ID: | 5b9f5ce70812161237j2c0cda12l2b35346a5101a2ba@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello. I have table classif with columns:
... , group1, group2, group3, ... , group48, ...
In function i do query and want run on every row and dynamically operate on
columns from group1 to group20. I do something like this:
OPEN curs FOR select * from classif;
loop
fetch curs into tmprec;
exit when not found;
for I in 1..20 loop
...
-- problem code is:
value := tmprec.group{I};
-- i cannot dynamically access to group1, group2, ... colomns according
to "I" variable.
...
end loop;
end loop;
I have to manually identify and handle each entry without a cycle do
something like this:
value := tmprec.group1;
...
value := tmprec.group2;
...
value := tmprec.group2;
...
value := tmprec.group20;
Please help me to do it dynamically with a loop, depending on the I?
something like this in a loop:
value := tmprec.group{I};
Thanks.
From | Date | Subject | |
---|---|---|---|
Next Message | Gauthier, Dave | 2008-12-16 20:38:15 | Re: Isolating a record column from a PL-Pgsql function call ? |
Previous Message | Andreas Kretschmer | 2008-12-16 20:18:54 | Re: Isolating a record column from a PL-Pgsql function call ? |