MOVE

Name

MOVE  --  Repositions the cursor to another row.

Synopsis

MOVE [ direction ] [ count ] 
    { IN | FROM } cursor
  

Parameters

direction

Use this parameter to specify the direction you wish to move the specified cursor. See FETCH or more information about the different usable directions.

count

This parameter takes the number of rows you wish to move the cursor.

cursor

Use this parameter to specify the cursor you are moving.

Results

The MOVE command will return the same errors and messages as the FETCH command; however, it will not return rows. See FETCH for more information on what messages you may encounter.

Description

Use the MOVE command to reposition a cursor. This command operates essentially the same as the FETCH command; however, it does not use the cursor to return rows after it is repositioned.

Examples

The following examples assume a transaction and an already-defined cusror ( cur_employee) that uses the employees table for data.

Now, using the MOVE command, we move two rows down the table.

booktown=# MOVE FORWARD 2 IN cur_employee;
MOVE

The only output returned by using this command is the message 'MOVE.' We can also use the FETCH command here to display the second row of the cursor.

booktown=# FETCH 1 IN mycursor;
  id  | last_name | first_name
 -----+-----------+------------
  102 | Holloway  | Michael
  (1 row)