Re: How the get variables out of a plggsql RECORD by column number

Поиск
Список
Период
Сортировка
От Keith Worthington
Тема Re: How the get variables out of a plggsql RECORD by column number
Дата
Msg-id 20050118185400.M4680@narrowpathinc.com
обсуждение исходный текст
Ответ на Re: How the get variables out of a plggsql RECORD by column number  (Jeff Eckermann <jeff_eckermann@yahoo.com>)
Список pgsql-novice
> > A record type contians the 1st row form dynamic
> > query result.
> >
> > From that row I want to select the 1st column.
> >
> > How do I do that?
>

Can you use a simple LOOP?

DECLARE rcrd_data RECORD

FOR rcrd_data IN SELECT tbl_source.first_column,
                        tbl_source.second_column,
                   FROM tbl_source
LOOP
-- Now rcrd_data.first_column has data.
END LOOP;

See
http://www.postgresql.org/docs/7.4/interactive/plpgsql-control-structures.html#PLPGSQL-RECORDS-ITERATING
for more information.

Kind Regards,
Keith

PS Caution, I am still a novice myself.

______________________________________________
99main Internet Services http://www.99main.com


В списке pgsql-novice по дате отправления:

Предыдущее
От: sarlav kumar
Дата:
Сообщение: generating dynamic queries using pl/pgsql
Следующее
От: "Pradeepkumar, Pyatalo (IE10)"
Дата:
Сообщение: dropdb command not working.