---
name: "SPI_scroll_cursor_fetch"
section: "3"
platform: "linux"
package: "postgresql"
version: "18.6-4"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/SPI_scroll_cursor_fetch"
---

# SPI\_scroll\_cursor\_fetch(3)

fetch some rows from a cursor

## NAME

SPI\_scroll\_cursor\_fetch - fetch some rows from a cursor

## SYNOPSIS

```
void SPI_scroll_cursor_fetch(Portal portal, FetchDirection direction,
                             long count)
```

## DESCRIPTION

**SPI\_scroll\_cursor\_fetch** fetches some rows from a cursor. This is equivalent to the SQL command **FETCH**.

## ARGUMENTS

Portal *portal*

portal containing the cursor

FetchDirection *direction*

one of FETCH\_FORWARD, FETCH\_BACKWARD, FETCH\_ABSOLUTE or FETCH\_RELATIVE

long *count*

number of rows to fetch for FETCH\_FORWARD or FETCH\_BACKWARD; absolute row number to fetch for FETCH\_ABSOLUTE; or relative row number to fetch for FETCH\_RELATIVE

## RETURN VALUE

*SPI\_processed* and *SPI\_tuptable* are set as in **SPI\_execute** if successful.

## NOTES

See the SQL [**FETCH**(7)](/FETCH/7.md) command for details of the interpretation of the *direction* and *count* parameters.

Direction values other than FETCH\_FORWARD may fail if the cursor's plan was not created with the CURSOR\_OPT\_SCROLL option.
