pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
HI! Problems with cursors into triggers
2+ messages / 1 participants
[nested] [flat]

* HI! Problems with cursors into triggers
@ 2000-06-23 22:03  Andrés Mauricio Marín Restrepo <amarin@alpha.telecom-co.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Andrés Mauricio Marín Restrepo @ 2000-06-23 22:03 UTC (permalink / raw)
  To: pgsql-sql

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
^ permalink raw reply [nested|flat] 2+ messages in thread

* HI! Problems with cursors into triggers
@ 2000-06-28 14:16  Andrés Mauricio Marín Restrepo <amarin@alpha.telecom-co.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Andrés Mauricio Marín Restrepo @ 2000-06-28 14:16 UTC (permalink / raw)
  To: pgsql-sql

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
^ permalink raw reply [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-06-28 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-06-23 22:03 HI! Problems with cursors into triggers Andrés Mauricio Marín Restrepo <amarin@alpha.telecom-co.net>
2000-06-28 14:16 HI! Problems with cursors into triggers Andrés Mauricio Marín Restrepo <amarin@alpha.telecom-co.net>

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