cursor and for update - Mailing list pgsql-sql

From Maciej Piekielniak
Subject cursor and for update
Date
Msg-id 1466365196.20060328013531@isb.com.pl
Whole thread Raw
Responses Re: cursor and for update
List 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
'
DECLAREtabela 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;
BEGINfor 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



pgsql-sql by date:

Previous
From: Wiebe Cazemier
Date:
Subject: Re: unique names in variables and columns in plsql functions
Next
From: Wiebe Cazemier
Date:
Subject: Re: cursor and for update