[PL/pgSQL] Commit every N rows. Is it possible ?

Поиск
Список
Период
Сортировка
От Jeremiasz Miedzinski
Тема [PL/pgSQL] Commit every N rows. Is it possible ?
Дата
Msg-id d0f7f1a80611090650s29e8a5c5hd4de17b9ff851bc0@mail.gmail.com
обсуждение исходный текст
Ответы Re: [PL/pgSQL] Commit every N rows. Is it possible ?  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
Hello,

I'm still trying to convert my PL/SQL stored procedures into PL/pgSQL. Now, I have problem with commiting transaction every N rows:

loop
fetch csr_ac into row_id;
   if not FOUND then
      exit;
   end if;
   counter := counter + 1;
   delete from spm_audit where adt_id=row_id;
   delete from spm_audit_pipeline_data where apd_adt_id=row_id;
   global_counter := global_counter + 1;
   if counter = rows_between_commit then
   counter := 0;
   commit;
   end if;
end loop;

I'm digging into postgresql documentation but maybe I'm just not smart enough to understand the way which transactions are being processed into pgSQL. Is it possible to port above code to PL/pgSQL ?

Kind Regards.

--
-- audi vide sile --

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: posgres headers
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: [PL/pgSQL] Commit every N rows. Is it possible ?