Hello, I’m DocuDroid!
Submitting feedback
Thank you for rating our AI Search!
We would be grateful if you could share your thoughts so we can improve our AI Search for you and other readers.
GitHub

MOVE

Positions a cursor.

Synopsis

MOVE [ <forward_direction> [ FROM | IN ] ] <cursor_name>

where forward_direction can be empty or one of:

NEXT
FIRST
LAST
ABSOLUTE <count>
RELATIVE <count>
<count>
ALL
FORWARD
FORWARD <count>
FORWARD 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.

NOTE

You cannot apply MOVE to a parallel retrieve cursor.

It is not possible to move a cursor position backwards in Greengage DB, since scrollable cursors are not supported. You can only move a cursor forward in position using MOVE.

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).

Parameters

Parameter Description

forward_direction

The parameters for the MOVE command are identical to those of the FETCH command; refer to FETCH for details on syntax and usage

cursor_name

The name of an open cursor

Examples

-- Start the transaction:
BEGIN;

-- Set up a cursor:
DECLARE mycursor CURSOR FOR SELECT * FROM films;

-- Move forward 5 rows in the `mycursor` cursor:
MOVE FORWARD 5 IN mycursor;
MOVE 5

-- Fetch the next row after that (row 6):
FETCH 1 FROM mycursor;
 code  | title  | did | date_prod  |  kind  |  len
-------+--------+-----+------------+--------+-------
 P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37
(1 row)

-- Close the cursor and end the transaction:
CLOSE mycursor;
COMMIT;

Compatibility

There is no MOVE statement in the SQL standard.

See also