Skip to main content

MOVE

Changes the position of a cursor.


Syntax

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

Different from FETCH, MOVE does not retrieve data nor return rows.

Relyt does not support scrollable cursors. Therefore, MOVE can only be used to move the cursor forward.

note

You cannot use MOVE to reposition parallel retrieve cursors.


Parameters

The parameters are the same as those of the FETCH statement. For more details, see section "Parameters" in FETCH.


Outputs

If a MOVE is successful, the command tag returned is in the following form:

MOVE <count>

<count> specifies the number of rows that a FETCH statement with the same parameters will return.

  1. Start a transaction:

    BEGIN;
  2. Declare a cursor:

    DECLARE cursor1 CURSOR FOR SELECT * FROM myplaylist;
  3. Move the cursor to the next row:

    MOVE NEXT in cursor1;
  4. Close the cursor and end the transaction:

    CLOSE mycursor;
    COMMIT;

SQL standard compatibility

The SQL standard does not support MOVE.