pl-pgsql question

From: "Vilson farias" <vilson(dot)farias(at)digitro(dot)com(dot)br>
To: <pgsql-general(at)postgresql(dot)org>
Subject: pl-pgsql question
Date: 2003-04-24 19:52:03
Message-ID: 020501c30a9b$083697b0$98a0a8c0@dgtac
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings,

I'm writing some stored procedures using pl-pgsql and I need to know how
many tuples were affected by a update/delete/insert command.

Let's suppose my script is like this :

CREATE FUNCTION gerachave(INT4) RETURNS INT4 AS'
DECLARE
CAD ALIAS FOR $1;
BEGIN
novovalor := 0;

UPDATE table1 SET is_ok = 1 WHERE cod_cad = CAD;

INSERT INTO cnfg_gerachave VALUES (<quantity of tuples affected by
UPDATE>);

RETURN CAD;
END;
'
LANGUAGE 'plpgsql';

Is it possible to discovery how many tuples were affected? How can I do it?

Thanks in advance.

----------------------------------------------------------------------------
----
José Vilson de Mello de Farias
Software Engineer

Dígitro Tecnologia Ltda - www.digitro.com.br
APC - Customer Oriented Applications
E-mail: vilson(dot)farias(at)digitro(dot)com(dot)br
Tel.: +55 48 281 7158
ICQ 11866179

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2003-04-24 19:53:04 Re: SERIAL type fields
Previous Message Robert Treat 2003-04-24 19:49:05 Re: [SQL] rewriting values with before trigger