Обсуждение: returns numbers of record

Поиск
Список
Период
Сортировка

returns numbers of record

От
"Enrico Pirozzi"
Дата:
Hi all,
does it exists a way to know how many records a query returns?

I thought sometime like

DECLARE curs1 CURSOR FOR select * from table ;

I thought if I can write MOVE LAST Is there any way to return
the number of row for  select * from table without execute a count(*) ?

Thanks :)

Enrico

--
That's one small step for man; one giant leap for mankind

www.enricopirozzi.info
info@enricopirozzi.info
Skype sscotty71

Re: returns numbers of record

От
justin
Дата:
Select Count(*) from (query)  is what i believe you are looking for see
http://www.postgresql.org/docs/8.3/interactive/tutorial-agg.html



Enrico Pirozzi wrote:
> Hi all,
> does it exists a way to know how many records a query returns?
>
> I thought sometime like
>
> DECLARE curs1 CURSOR FOR select * from table ;
>
> I thought if I can write MOVE LAST Is there any way to return
> the number of row for  select * from table without execute a count(*) ?
>
> Thanks :)
>
> Enrico
>
>


Re: returns numbers of record

От
"Enrico Pirozzi"
Дата:
No I'm looking something else, as I wrote above :)

Regards
Enrico

2008/12/3 justin <justin@emproshunts.com>:
> Select Count(*) from (query)  is what i believe you are looking for see
>  http://www.postgresql.org/docs/8.3/interactive/tutorial-agg.html
>
>
>
> Enrico Pirozzi wrote:
>>
>> Hi all,
>> does it exists a way to know how many records a query returns?
>>
>> I thought sometime like
>>
>> DECLARE curs1 CURSOR FOR select * from table ;
>>
>> I thought if I can write MOVE LAST Is there any way to return
>> the number of row for  select * from table without execute a count(*) ?
>>
>> Thanks :)
>>
>> Enrico
>>
>>
>
>



--
That's one small step for man; one giant leap for mankind

www.enricopirozzi.info
info@enricopirozzi.info
Skype sscotty71

Re: returns numbers of record

От
Richard Huxton
Дата:
Enrico Pirozzi wrote:
> Hi all,
> does it exists a way to know how many records a query returns?

Not without fetching the rows. If you're not using a cursor then all the
rows will be fetched anyway and whatever library you're using will
almost certainly have a pg_numrows() function or some such.

--
  Richard Huxton
  Archonet Ltd