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

From: "Jeremiasz Miedzinski" <jmiedzinski(at)gmail(dot)com>
To: "PostgreSQL Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: [PL/pgSQL] Commit every N rows. Is it possible ?
Date: 2006-11-09 14:50:16
Message-ID: d0f7f1a80611090650s29e8a5c5hd4de17b9ff851bc0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 --

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeremiasz Miedzinski 2006-11-09 14:57:06 Re: cannot connect anymore from a remote host
Previous Message Adrian Klaver 2006-11-09 14:41:37 Re: posgres headers