From: | Maciej Piekielniak <piechcio(at)isb(dot)com(dot)pl> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | cursor and for update |
Date: | 2006-03-27 23:35:31 |
Message-ID: | 1466365196.20060328013531@isb.com.pl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)isb(dot)com(dot)pl
From | Date | Subject | |
---|---|---|---|
Next Message | Wiebe Cazemier | 2006-03-28 00:42:20 | Re: cursor and for update |
Previous Message | Wiebe Cazemier | 2006-03-27 21:39:04 | Re: unique names in variables and columns in plsql functions |