Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

Next:From: Craig RingerDate: 2011-11-29 06:25:11
Subject: Re: psql query gets stuck indefinitely
Previous:From: tamanna madaanDate: 2011-11-29 03:21:12
Subject: Re: psql query gets stuck indefinitely

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group