From: | arthur_info <arthur_info(at)yahoo(dot)com(dot)br> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Retrieve the column values of a record without knowing the names |
Date: | 2011-02-16 16:18:19 |
Message-ID: | 1297873099984-3387935.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello,
I've got the following function and I want to access the fields values of my
record by index. The problem is that my select is retrieving each record
line with all values and not each one of each row on my view... How can I
solve this problem?
Thanks in advance.
CREATE FUNCTION fc_teste_tce(aluno integer) RETURNS character varying AS
$BODY$
DECLARE
reg record;
BEGIN
for reg in execute 'SELECT ARRAY (SELECT vw_teste_tce FROM
estagio.vw_teste_tce where aluno = ''3043'' LIMIT 20) AS campos' loop
for j in 1..array_upper(reg.campos,1) loop
raise notice 'Field Value: %',reg.campos[j];
end loop;
end loop;
return 'ok';
END;
$BODY$
LANGUAGE plpgsql VOLATILE;
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Retrieve-the-column-values-of-a-record-without-knowing-the-names-tp3387935p3387935.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | Igor Neyman | 2011-02-16 16:24:51 | Re: Function compile error |
Previous Message | arthur_info | 2011-02-16 16:16:16 | Retrieve the column values of a record without knowing the names |