Convert Cursor to array
От | GIROIRE Nicolas (COFRAMI) |
---|---|
Тема | Convert Cursor to array |
Дата | |
Msg-id | 1904E3EB39448246A7ECB76DF34A70B0036A3F9A@TOCOMEXC03 обсуждение исходный текст |
Ответы |
Re: Convert Cursor to array
|
Список | pgsql-general |
Hi,
In a procedure, I put data of Cursor in a two-dimensional array. This allows me to sort rows.
The problem is this method is too slow.
In fact, I translate a pl/sql procedure to a plpgsql.
Under Oracle, we use bulk and I search to use equivalent of this under postgresql.
Is that exist ?
Oracle procedure
cursor childCursor is select * from CHILD WHERE......
....
open childCursor;
fetch childCursor bulk collect into children;
close childCursor;
Postgresql procedure :
FOR childRecord IN select * from nico.CHILD WHERE...
LOOP
-- on met les éléments dans le tableau
children[recordcount] := '{'
|| childRecord.child_id || ','
|| childRecord.evolution || ','
|| childRecord.isremoved || ','
|| childRecord.child_class || ','
|| childRecord.indx || ','
|| childRecord.ele_id || ','
|| childRecord.doc_id ||
'}';
recordcount := recordcount + 1;
END LOOP;
Bulk are native Oracle array and it is probably faster than array.
Is there native method postgresql to replace bulk ?
Best regards.
В списке pgsql-general по дате отправления: