| От | Kevin B. |
|---|---|
| Тема | assign the row count of a query to a variable |
| Дата | |
| Msg-id | 1386.67.87.30.165.1105735384.squirrel@www.ke5in.com обсуждение |
| Ответы |
Re: assign the row count of a query to a variable
Re: assign the row count of a query to a variable |
| Список | pgsql-sql |
Hi, I'm trying to assign the row count of a query to a variable in a function but I'm not having any luck. Could someone tell me the syntax? I've been looking in the docs and googling for a long time but just can't find the answer. I've tried: CREATE OR REPLACE FUNCTION ret1() RETURNS int4 AS ' BEGIN declare var int4; begin --select var count(*) from T; --select var (count(*)) from T; --select var = count(*) from T; var =select count(*) from T; return var; END; END; ' LANGUAGE 'plpgsql';
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера