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

Поиск
Список
Период
Сортировка
От Ernesto Quiniones
Тема Re: PLPGSQL: How can I get the effected rows when use "execute" command in function
Дата
Msg-id 1322575429.12115.2.camel@Nokia-N900
обсуждение исходный текст
Ответ на PLPGSQL: How can I get the effected rows when use "execute" command in function  (Muiz <work.muiz@gmail.com>)
Список pgsql-general
if you are doing insert, update or delete you can use "retuirng" command in the query, work with a cursor to get the
rows


----- Mensaje original -----
> 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*


В списке pgsql-general по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: PLPGSQL: How can I get the effected rows when use "execute" command in function
Следующее
От: Mike Wylde
Дата:
Сообщение: initdb failure on Windows 2003