PLPGSQL - store fetched records in array of record

Поиск
Список
Период
Сортировка
От Durumdara
Тема PLPGSQL - store fetched records in array of record
Дата
Msg-id CAEcMXhmEJjrqruc0RUSNeUiUzzCf7K_TxuUAzFZoNBi_UzQdzA@mail.gmail.com
обсуждение исходный текст
Ответы Re: PLPGSQL - store fetched records in array of record
Re: PLPGSQL - store fetched records in array of record
Список pgsql-general
Hello!

I have to store some fetched records into two lists (arrays) to work with them.

I can use the RECORD type in a FOR SELECT loop to get one row data.

declare 
  f record;
begin 
  for f in select title, length

But if I tried to define an "array of record", I got an error message.

declare 
  R_A record[]; <---- some error

So I can't store the fetched data into an array simply.

Ok, I found a solution when I define a TYPE, and I use this:

declare 
  f TMy_Record;
  R_A TMy_Record[];

Then I can work with the data.

But this means a dependency, so I can't change the TYPE without pre-dropping the stored procedure (and without recreating after).

Is there any way to avoid this? To use a "simple untyped record" in an array without "dependencies"?

Thank you for the answer!

Best regards
dd

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