| От | Rajesh Kumar Mallah |
|---|---|
| Тема | PL/PGSQL help for getting number of rows matched. |
| Дата | |
| Msg-id | 200311101619.00094.mallah@trade-india.com обсуждение исходный текст |
| Ответы |
Re: PL/PGSQL help for getting number of rows matched.
|
| Список | pgsql-general |
Hi,
We need to implement following logic efficiently.
SELECT * from some_table where .... [ Query 1 ]
IF rows_matched = 1 THEN
use the single row that matched.
ELSIF
loop thru the results of [Query 1]
END IF;
Currently i am doing select count(*) for getting rows_matched
in the top and repeating the same query in both branches of IF
to get the data of matching rows.
I have tried GET DIAGNOSTICS ROW_COUNT but for
"SELECTS" if returns 0 or 1 based on matching
I am sure there exists better methods. Kindly post a link
to better documentation of pl/pgsql or point out section in
the standard docs that discuss this issue.
Regds
Mallah.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера