PLPGSQL: How can I get the effected rows when use "execute" command in function

From: Muiz <work(dot)muiz(at)gmail(dot)com>
To: questions(at)postgresql(dot)org
Subject: PLPGSQL: How can I get the effected rows when use "execute" command in function
Date: 2011-11-29 04:20:54
Message-ID: CAF2hCqznYOcmn3DOBVHb_W443Oz+QqSe6MpCTgoPyz2j+YTO9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear all,

Can I get the effected rows after executing sqls in function?
e.g.:

CREATE OR REPLACE FUNCTION execsqls(sqls character varying)
RETURNS integer AS
$BODY$
DECLARE
BEGIN
EXECUTE sqls;
-- TODO-1: I want to know how many records the input sqls
effects?
RETURN effectedRows;
END;
$BODY$
LANGUAGE plpgsql;

test: select execsqls('update mytable where name like ''%abc''')

--
Regards,
*Muiz*

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2011-11-29 06:25:11 Re: psql query gets stuck indefinitely
Previous Message tamanna madaan 2011-11-29 03:21:12 Re: psql query gets stuck indefinitely