开发者

Cursor size (number of results)

开发者 https://www.devze.com 2023-03-21 01:20 出处:网络
How I can 开发者_开发知识库know cursor size (numbers of results)? c CURSOR IS SELECT foo FROM mytable WHERE name=\'ok\';

How I can 开发者_开发知识库know cursor size (numbers of results)?

c CURSOR IS SELECT foo FROM mytable WHERE name='ok';


In my understanding, a cursor is NOT the result. You can use a cursor to GET your results row by row, and at the end of this row by row operations, you know how many results you got.

To know how many records you will (possibly) get, you can use a

select count(*) from ... where ...

assuming you have an index on column name, you could also write:

select count(name) from foo where name = 'ok'


If you want to obtain the total number of results without issuing a separate count query, you can:

SELECT count(1) OVER (), ... FROM ... WHERE ...

The count will be unaffected by ORDER/LIMIT clauses.

0

精彩评论

暂无评论...
验证码 换一张
取 消