Re: How to tell if that UPDATE worked?

From: Jan Wieck <janwieck(at)Yahoo(dot)com>
To: drevil(at)sidereal(dot)kz
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to tell if that UPDATE worked?
Date: 2001-01-11 20:10:00
Message-ID: 200101112010.PAA04955@jupiter.jw.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

drevil(at)sidereal(dot)kz wrote:
>
> I'm writing some stuff in PL/pgsql (actually, a lot of stuff). I have
> a question: At various times, it does UPDATEs. Is there a way to tell
> if the UPDATE actually affected any rows or not? I couldn't see how
> to get UPDATE to return anything.

Do a

GET DIAGNOSTICS SELECT PROCESSED INTO <int4_variable>;

directly after an INSERT, UPDATE or DELETE statement and
you'll know how many rows have been hit.

Also you can get the OID of an inserted row with

GET DIAGNOSTICS SELECT RESULT INTO <int4_variable>;

Er - is this another added feature where we're still lacking
documentation?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dan Moschuk 2001-01-11 20:11:07 exit status 26
Previous Message Nelio Alves Pereira Filho 2001-01-11 19:52:53 Re: Modeling tool / ODBC