From: | Andrés Mauricio Marín Restrepo <amarin(at)alpha(dot)telecom-co(dot)net> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | HI! Problems with cursors into triggers |
Date: | 2000-06-23 22:03:35 |
Message-ID: | 3953DEB7.3C9DE97B@alpha.telecom-co.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
Attachment | Content-Type | Size |
---|---|---|
amarin.vcf | text/x-vcard | 238 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Brian P. Mann | 2000-06-23 22:04:31 | Re: query failed , don't know why |
Previous Message | Mitch Vincent | 2000-06-23 19:46:13 | Speaking of fulltextindex... |