MOVE(7)

πŸ“¦ version 15.19, in opensuse-leap 16.0

πŸ’… MOVE(7) β€” the PostgreSQL glow-up page

ok so quick vibe check: you're reading the PostgreSQL 15.19 Documentation page for MOVE, and honestly? she's a quiet icon. no rows returned, no drama, just pure positioning ✨


✨ NAME ✨

MOVE β€” position a cursor 🎯


🌸 SYNOPSIS 🌸

MOVE [ direction ] [ FROM | IN ] cursor_name

where direction can be one of:

NEXT
PRIOR
FIRST
LAST
ABSOLUTE count
RELATIVE count
count
ALL
FORWARD
FORWARD count
FORWARD ALL
BACKWARD
BACKWARD count
BACKWARD ALL

bestie that's the whole menu and yes you can order any of it πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so MOVE repositions a cursor without retrieving any data. that's it. that's the whole job. she moves, she doesn't bring snacks back for you. 🫢

MOVE works exactly like the FETCH command, except it only positions the cursor and does not return rows. so like… FETCH's chill twin who shows up to the party and doesn't take anything from the fridge. 🧚

the parameters for the MOVE command are identical to those of the FETCH command; refer to FETCH(7) for details on syntax and usage. iykyk 😌


πŸŽ€ OUTPUTS πŸŽ€

on successful completion, a MOVE command returns a command tag of the form:

MOVE count

count is the number of rows that a FETCH command with the same parameters would have returned (possibly zero). and yes, possibly zero β€” sometimes the answer is zero and that's still valid, no cap πŸ’€


πŸ‘‘ EXAMPLES πŸ‘‘

okay this one's a whole little story, watch:

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;

see how she skips 5 rows and the tag is literally MOVE 5? that's the whole flex. then FETCH 1 lands on row 6 like it was always meant to be. main character energy honestly 🌟


🌈 COMPATIBILITY 🌈

there is no MOVE statement in the SQL standard. she's built different, she's a PostgreSQL original, she's not on the standardized syllabus πŸ’…


πŸ’œ SEE ALSO πŸ’œ

go read FETCH(7) fr fr, that's where the real details live πŸ“š


aaaaand that's the page bestie πŸŽ€ huge thanks to the PostgreSQL 15.19 docs, dated 2026, for letting this cursor have her moment. mwah πŸ’‹ stay positioned, stay iconic ⭐

πŸ“¦ where this page comes from