MOVE

|        MOVE         |                       |            |                  |                        |
|:-------------------:|-----------------------|------------|------------------|------------------------|
|[Prev](sql-lock.html)|[Up](sql-commands.html)|SQL Commands|[Home](index.html)| [Next](sql-notify.html)|

---

[]()[]()

## MOVE

MOVE — position a cursor

## Synopsis

```
MOVE [ direction [ FROM | IN ] ] cursor_name

where direction can be empty or one of:

    NEXT
    PRIOR
    FIRST
    LAST
    ABSOLUTE count
    RELATIVE count
    count
    ALL
    FORWARD
    FORWARD count
    FORWARD ALL
    BACKWARD
    BACKWARD count
    BACKWARD ALL

```

## Description

`MOVE` repositions a cursor without retrieving any data. `MOVE` works exactly like the `FETCH` command, except it only positions the cursor and does not return rows.

 The parameters for the `MOVE` command are identical to those of the `FETCH` command; refer to [FETCH](sql-fetch.html) for details on syntax and usage.

## Outputs

 On successful completion, a `MOVE` command returns a command tag of the form

```
MOVE count

```

 The *`count`* is the number of rows that a `FETCH` command with the same parameters would have returned (possibly zero).

## Examples

```
BEGIN WORK;
DECLARE liahona CURSOR FOR SELECT * FROM films;

-- Skip the first 5 rows:
MOVE FORWARD 5 IN liahona;
MOVE 5

-- Fetch the 6th row from the cursor liahona:
FETCH 1 FROM liahona;
 code  | title  | did | date_prod  |  kind  |  len
-------+--------+-----+------------+--------+-------
 P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37
(1 row)

-- Close the cursor liahona and end the transaction:
CLOSE liahona;
COMMIT WORK;

```

## Compatibility

 There is no `MOVE` statement in the SQL standard.

## See Also

[CLOSE](sql-close.html), [DECLARE](sql-declare.html), [FETCH](sql-fetch.html)

---

|[Prev](sql-lock.html)|[Up](sql-commands.html)| [Next](sql-notify.html)|
|:--------------------|:---------------------:|-----------------------:|
|        LOCK         |  [Home](index.html)   |         NOTIFY         |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>