From: Maciej Piekielniak <piechcio@isb.com.pl>
To: pgsql-sql@postgresql.org
Subject: cursor and for update
Date: Tue, 28 Mar 2006 01:35:31 +0200
Message-ID: <1466365196.20060328013531@isb.com.pl> (raw)
Hello ,
I try to translate my old functions from oracle but don't understand what is wrong.
create or replace function uporzadkuj_reguly(text,text) RETURNS integer AS
'
DECLARE
tabela ALIAS FOR $1;
lancuch ALIAS FOR $2;
ret integer:=0;
licznik integer:=1;
rekord firewall%ROWTYPE;
reguly CURSOR FOR SELECT * from firewall ORDER BY id_firewall WHERE tabela=tabela and lancuch=lancuch for UPDATE;
BEGIN
for i in reguly LOOP
UPDATE firewall SET id_firewall=licznik WHERE CURRENT OF reguly;
licznik:=licznik+1;
END LOOP;
return ret;
END;'
LANGUAGE 'plpgsql';
--
Best regards,
Maciej mailto:piechcio@isb.com.pl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: piechcio@isb.com.pl
Subject: Re: cursor and for update
In-Reply-To: <1466365196.20060328013531@isb.com.pl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox