> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/19/server-programming/spi/spi-interface/spi-spi-scroll-cursor-move.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# SPI\_scroll\_cursor\_move

### SPI\_scroll\_cursor\_move

SPI\_scroll\_cursor\_move — 移動游標

### 概要

```

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

### 描述

`SPI_scroll_cursor_move` 會在游標中跳過若干資料列。這等同於 SQL 指令 `MOVE`。

### 引數

`Portal portal` : 含有該游標的 portal

`FetchDirection direction` : `FETCH_FORWARD`、`FETCH_BACKWARD`、`FETCH_ABSOLUTE` 或 `FETCH_RELATIVE` 其中之一

`long count` : 對 `FETCH_FORWARD` 或 `FETCH_BACKWARD` 而言是要移動的資料列數；對 `FETCH_ABSOLUTE` 而言是要移動到的絕對資料列編號；對 `FETCH_RELATIVE` 而言則是要移動到的相對資料列編號

### 回傳值

若執行成功，`SPI_processed` 的設定方式和 `SPI_execute` 相同。`SPI_tuptable` 會被設為 `NULL`，因為這個函式不會回傳任何資料列。

### 註記

關於 *`direction`* 與 *`count`* 參數如何解讀的細節，請參閱 SQL 的 [FETCH](https://docs.postgresql.tw/19/reference/sql-commands/sql-fetch.md) 指令。

如果該游標的執行計畫在建立時未使用 `CURSOR_OPT_SCROLL` 選項，那麼除了 `FETCH_FORWARD` 以外的方向值都可能會失敗。

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/spi-spi-scroll-cursor-move.html)（原文版本：18.6；核對日期：2026-09-13）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.postgresql.tw/19/server-programming/spi/spi-interface/spi-spi-scroll-cursor-move.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
