1MOVE(7) PostgreSQL 14.3 Documentation MOVE(7)
2
3
4
6 MOVE - position a cursor
7
9 MOVE [ direction [ FROM | IN ] ] cursor_name
10
11 where direction can be empty or one of:
12
13 NEXT
14 PRIOR
15 FIRST
16 LAST
17 ABSOLUTE count
18 RELATIVE count
19 count
20 ALL
21 FORWARD
22 FORWARD count
23 FORWARD ALL
24 BACKWARD
25 BACKWARD count
26 BACKWARD ALL
27
29 MOVE repositions a cursor without retrieving any data. MOVE works
30 exactly like the FETCH command, except it only positions the cursor and
31 does not return rows.
32
33 The parameters for the MOVE command are identical to those of the FETCH
34 command; refer to FETCH(7) for details on syntax and usage.
35
37 On successful completion, a MOVE command returns a command tag of the
38 form
39
40 MOVE count
41
42 The count is the number of rows that a FETCH command with the same
43 parameters would have returned (possibly zero).
44
46 BEGIN WORK;
47 DECLARE liahona CURSOR FOR SELECT * FROM films;
48
49 -- Skip the first 5 rows:
50 MOVE FORWARD 5 IN liahona;
51 MOVE 5
52
53 -- Fetch the 6th row from the cursor liahona:
54 FETCH 1 FROM liahona;
55 code | title | did | date_prod | kind | len
56 -------+--------+-----+------------+--------+-------
57 P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37
58 (1 row)
59
60 -- Close the cursor liahona and end the transaction:
61 CLOSE liahona;
62 COMMIT WORK;
63
65 There is no MOVE statement in the SQL standard.
66
68 CLOSE(7), DECLARE(7), FETCH(7)
69
70
71
72PostgreSQL 14.3 2022 MOVE(7)