X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E557A9DC9F3 for ; Mon, 27 Mar 2006 19:35:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00442-04 for ; Mon, 27 Mar 2006 19:35:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from isb.com.pl (isb.com.pl [212.160.150.140]) by postgresql.org (Postfix) with ESMTP id D31679DC9C0 for ; Mon, 27 Mar 2006 19:35:28 -0400 (AST) Received: from 192.168.0.17 (sembrz [192.168.1.50]) by isb.com.pl (Postfix) with ESMTP id B51E957842 for ; Tue, 28 Mar 2006 01:32:00 +0200 (CEST) Date: Tue, 28 Mar 2006 01:35:31 +0200 From: Maciej Piekielniak X-Mailer: The Bat! (v1.62r) Reply-To: Maciej Piekielniak X-Priority: 3 (Normal) Message-ID: <1466365196.20060328013531@isb.com.pl> To: pgsql-sql@postgresql.org Subject: cursor and for update MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.099 required=5 tests=[AWL=0.099, UPPERCASE_25_50=0] X-Spam-Score: 0.099 X-Spam-Level: X-Archive-Number: 200603/439 X-Sequence-Number: 24785 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