pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrés Mauricio Marín Restrepo <amarin@alpha.telecom-co.net>
To: pgsql-sql@postgresql.org
Subject: HI! Problems with cursors into triggers
Date: Wed, 28 Jun 2000 09:16:24 -0500
Message-ID: <395A08B8.FBEFAA0C@alpha.telecom-co.net> (raw)

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

Attachments:

amarin.vcf (text/x-vcard, 237B) download 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

view thread (2+ messages)

Message-ID: <395A08B8.FBEFAA0C@alpha.telecom-co.net>
Permalink:  ../395A08B8.FBEFAA0C@alpha.telecom-co.net/
Also on:    postgresql.org/message-id/395A08B8.FBEFAA0C@alpha.telecom-co.net

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: amarin@alpha.telecom-co.net
  Subject: Re: HI! Problems with cursors into triggers
  In-Reply-To: <395A08B8.FBEFAA0C@alpha.telecom-co.net>
  References: <395A08B8.FBEFAA0C@alpha.telecom-co.net>

* 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