Re: rowcount

From: Anna Dorofiyenko <anna(dot)dorofiyenko(at)xdrive(dot)com>
To: "'Samuel J(dot) Sutjiono'" <ssutjiono(at)wc-group(dot)com>, Mike Mascari <mascarm(at)mascari(dot)com>, Anna Dorofiyenko <anna(dot)dorofiyenko(at)xdrive(dot)com>
Cc: Pgsql-General <pgsql-general(at)postgresql(dot)org>, "'Joe Conway'" <mail(at)joeconway(dot)com>
Subject: Re: rowcount
Date: 2002-05-01 20:53:32
Message-ID: E1FC1AAA6B00B644BD3FB7DFBCA97357022102A1@renoir.corp.xdrive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This is exactly what I needed.
Thanks a lot.

-----Original Message-----
From: Samuel J. Sutjiono [mailto:ssutjiono(at)wc-group(dot)com]
Sent: Wednesday, May 01, 2002 1:42 PM
To: Mike Mascari; Anna Dorofiyenko
Cc: Pgsql-General
Subject: Re: [GENERAL] rowcount

That's correct.

DECLARE
rec_added int;

Begin
Insert.....
Get Diagnostics rec_added = ROW_COUNT;
IF rec_added > 0 then

Regards,
Sam

----- Original Message -----
From: "Mike Mascari" <mascarm(at)mascari(dot)com>
To: "Anna Dorofiyenko" <anna(dot)dorofiyenko(at)xdrive(dot)com>
Cc: "Pgsql-General" <pgsql-general(at)postgresql(dot)org>
Sent: Wednesday, May 01, 2002 3:02 PM
Subject: Re: [GENERAL] rowcount

> > Anna Dorofiyenko wrote:
> >
> > Hello, list.
> > How can I get in PL/pgSQL number of rows affected by insert/update?
> >
> > I'm looking to do something like:
> > insert into...
> > If rowcount>0
> > then ...
>
> I believe its GET DIAGNOSTICS:
>
> GET DIAGNOSTICS rowcount = ROW_COUNT;
>
> The docs seem pretty paltry on the subject, but here's a link:
>
> http://www.postgresql.org/idocs/index.php?plpgsql-statements.html
>
> >
> > Thank you.
> > Anna
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

Browse pgsql-general by date

  From Date Subject
Next Message Jakub Ouhrabka 2002-05-01 20:59:21 Re: FATAL: stuck spinlock
Previous Message Patrick Welche 2002-05-01 20:52:47 aggregate on zero rows slow?