MOVE

Name

MOVE — Moves cursor position
MOVE [ selector ] { [ # | ALL ] } IN cursor

Inputs

selector

FORWARD

Skip next row(s), it is assumed by default if selector is omitted.

BACKWARD

Skip previous row(s).

#

An unsigned integer that specify how many rows to skip.

ALL

Skip all remaining rows.

cursor

An open cursor's name.

Outputs

MOVE

Message returned if successfully.

NOTICE: PerformPortalFetch: portal cursor not found.

If cursor is not declared.

Description

MOVE allows a user to move cursor position for specified number of rows. MOVE works like fetch command: it fetches rows, but put them nowhere.

Notes

MOVE is a Postgres language extension.

Refer to FETCH statements for further description of valid arguments. Refer to DECLARE statements to declare a cursor. Refer to BEGIN WORK, COMMIT WORK, ROLLBACK WORK statements for further information about transactions.

Usage

   --set up and use a cursor:
   --
   BEGIN WORK;
     DECLARE liahona CURSOR 
         FOR SELECT * FROM films;
   
   --Skip first 5 rows:
   --
     MOVE FORWARD 5 IN liahona;
   
   --Fetch 6th row in the cursor liahona:
   --
     FETCH 1 IN liahona;

     code |title |did| date_prod|kind      |len
     -----+------+---+----------+----------+------
     P_303|48 Hrs|103|1982-10-22|Action    | 01:37

   -- close the cursor liahona and commit work:
   --
     CLOSE liahona;
   COMMIT WORK;

Compatibility

SQL92

There is no SQL92 MOVE statement.