Re: use cursor in a function
От | Rory Campbell-Lange |
---|---|
Тема | Re: use cursor in a function |
Дата | |
Msg-id | 20030617174449.GA8576@campbell-lange.net обсуждение исходный текст |
Ответ на | Re: use cursor in a function (Joe Conway <mail@joeconway.com>) |
Ответы |
Re: use cursor in a function
|
Список | pgsql-novice |
In a nutshell: Is there a way of finding out how many rows (ROW_COUNT) are in a cursor select? If one can, is there a way of returning a RECORD containing the refcursor and the ROW_COUNT? So far I've only been able to get a clue from: 1) Define function create or replace function mycur(refcursor) returns refcursor AS ' BEGIN open $1 for select * from abc; RETURN $1; END; ' LANGUAGE 'plpgsql'; 2) Call function temporary=> select mycur('cur'); mycur ------- cur (1 row) 3) Try to find end of cursor temporary=> move 99 from cur; MOVE 5 On 17/06/03, Joe Conway (mail@joeconway.com) wrote: > Rory Campbell-Lange wrote: > >Is this sensible, efficient, feasible? I have not used cursors before. > > > >Or should I simply do 2 separate functions, 1 for NUM_ROWS, the > >other for the result set I want? > > It's hard to offer advice (at least for me) without more context. What > are you trying to accomplish (in more detail), and in what type of > application (web, fat client, etc)? -- Rory Campbell-Lange <rory@campbell-lange.net> <www.campbell-lange.net>
В списке pgsql-novice по дате отправления: