MOVE
MOVE — position a cursor
Synopsis
MOVE [direction
] [ FROM | IN ]cursor_name
wheredirection
can be one of: NEXT PRIOR FIRST LAST ABSOLUTEcount
RELATIVEcount
count
ALL FORWARD FORWARDcount
FORWARD ALL BACKWARD BACKWARDcount
BACKWARD ALL
Description
MOVE
repositions a cursor without retrieving any data.MOVE
works exactly like theFETCH
command, except it only positions the cursor and does not return rows.
The parameters for theMOVE
command are identical to those of theFETCH
command; refer toFETCH for details on syntax and usage.
Outputs
On successful completion, aMOVE
command returns a command tag of the form
MOVEcount
Thecount
is the number of rows that aFETCH
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 noMOVE
statement in the SQL standard.