Re: getting the number of rows affected by a query - Mailing list pgsql-general

From Erik Jones
Subject Re: getting the number of rows affected by a query
Date
Msg-id 77708784-2E9A-4F75-BC67-F947056A819E@myemma.com
Whole thread Raw
In response to Re: getting the number of rows affected by a query  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
Responses Re: getting the number of rows affected by a query  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
List pgsql-general
On Nov 16, 2007, at 3:26 AM, Ow Mun Heng wrote:

>
> On Fri, 2007-11-16 at 10:22 +0100, Martijn van Oosterhout wrote:
>> On Fri, Nov 16, 2007 at 09:00:46AM +0800, Ow Mun Heng wrote:
>>> I usually write a function which gets/uses the GETS DIAGNOSTIC
>>> ROW COUNT
>>> parameter which will tell me how many rows were affected by the
>>> query.
>>>
>>> Now, for this case, I'm not writing a function but merely using a
>>> normal
>>> SQL eg:
>>
>> The server provides the number of changed rows in its response. Like
>> DELETE 2030. So check whatever you're using to run the commands.
>>
>
> The question is on how to use this number to be inserted into a table
> instead of just being informational.

The specifics depend on what language you're using for your database
access.  Regardless, though, save the server's response in a variable
and use that.

Erik Jones

Software Developer | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com



pgsql-general by date:

Previous
From: "Pau Marc Munoz Torres"
Date:
Subject: Re: moving from mysql to postgree
Next
From: "Scott Marlowe"
Date:
Subject: Re: public schema doubt