Received: from alpha.telecom-co.net ([200.21.27.100]) by hub.org (8.10.1/8.10.1) with ESMTP id e5NLxR180882 for ; Fri, 23 Jun 2000 17:59:33 -0400 (EDT) Received: from alpha.telecom-co.net (200.21.28.21 [200.21.28.21]) by alpha.telecom-co.net with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id N1BN4HKV; Fri, 23 Jun 2000 16:58:44 -0500 Message-ID: <3953DEB7.3C9DE97B@alpha.telecom-co.net> Date: Fri, 23 Jun 2000 17:03:35 -0500 From: =?iso-8859-1?Q?Andr=E9s?= Mauricio =?iso-8859-1?Q?Mar=EDn?= Restrepo X-Mailer: Mozilla 4.7 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: HI! Problems with cursors into triggers Content-Type: multipart/mixed; boundary="------------36CDE695507DC7332B8BF88A" X-Archive-Number: 200006/248 This is a multi-part message in MIME format. --------------36CDE695507DC7332B8BF88A Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit HELLO! I'm making one trigger (plpgsql) and in the function i use CURSOR for to bring an elements and to take them to a variable but no me it does not work, WHY????????????? The script is: DROP TRIGGER miTrig on otro; DROP FUNCTION miFunc(); DROP TABLE otro; DROP TABLE cual; CREATE TABLE otro ( cuenta integer; ); CREATE TABLE cual ( cuenta1 integer; cuenta2 integer; ); CREATE FUNCTION miFunc () RETURNS OPAQUE AS ' DECLARE Cuenta_t INT4; BEGIN begin work; declare c_Cuenta CURSOR FOR SELECT * FROM otro; FETCH forward 1 in c_Cuenta INTO :Cuenta_t; CLOSE c_Cuenta; commit; INSERT INTO cual VALUES (Cuenta_t,NEW.cuenta); RETURN NEW; END; ' LANGUAGE 'plpgsql'; CREATE TRIGGER miTrig AFTER INSERT ON otro FOR EACH ROW EXECUTE PROCEDURE miFunc(); Help me please!!!!!!!!!!!!!!! Thanks Mauricio Marín Colombia --------------36CDE695507DC7332B8BF88A Content-Type: text/x-vcard; charset=us-ascii; name="amarin.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Andrés Mauricio Marín Restrepo Content-Disposition: attachment; filename="amarin.vcf" begin:vcard n:Marín Restrepo;Andrés Mauricio x-mozilla-html:FALSE org:ITEC TELECOM;Research Departament adr:;;;;;; version:2.1 email;internet:amarin@alpha.telecom-co.net title:System Enginner fn:Andrés Mauricio Marín Restrepo end:vcard --------------36CDE695507DC7332B8BF88A--