FETCH
FETCH retrieves rows from a query using a cursor previously opened with DECLARE.
Syntax
FETCH [ <count> | ALL ] [FROM] <cursor_name> [ WITH ( TIMEOUT = <interval> ) ]
| Syntax element | Description |
|---|---|
<count>
|
The number of rows to retrieve. Defaults to 1 if unspecified.
|
ALL
|
Indicates that there is no limit on the number of rows to be returned. |
<cursor_name>
|
The name of an open cursor. |
TIMEOUT
|
When fetching from a SUBSCRIBE cursor, complete if there are no more rows ready after this timeout. The default will cause FETCH to wait for at least one row to be available.
|
Details
FETCH will return at most the specified count of available rows. Specifying a count of ALL indicates that there is no limit on the number of
rows to be returned.
For SUBSCRIBE queries, FETCH by default will wait for rows to be available before returning.
Specifying a timeout of 0s returns only rows that are immediately available.