]> begriffs open source - ai-pg/blob - full-docs/txt/sql-move.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / sql-move.txt
1
2 MOVE
3
4    MOVE — position a cursor
5
6 Synopsis
7
8 MOVE [ direction ] [ FROM | IN ] cursor_name
9
10 where direction can be one of:
11
12     NEXT
13     PRIOR
14     FIRST
15     LAST
16     ABSOLUTE count
17     RELATIVE count
18     count
19     ALL
20     FORWARD
21     FORWARD count
22     FORWARD ALL
23     BACKWARD
24     BACKWARD count
25     BACKWARD ALL
26
27 Description
28
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 for details on syntax and usage.
35
36 Outputs
37
38    On successful completion, a MOVE command returns a command tag of the
39    form
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
45 Examples
46
47 BEGIN WORK;
48 DECLARE liahona CURSOR FOR SELECT * FROM films;
49
50 -- Skip the first 5 rows:
51 MOVE FORWARD 5 IN liahona;
52 MOVE 5
53
54 -- Fetch the 6th row from the cursor liahona:
55 FETCH 1 FROM liahona;
56  code  | title  | did | date_prod  |  kind  |  len
57 -------+--------+-----+------------+--------+-------
58  P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37
59 (1 row)
60
61 -- Close the cursor liahona and end the transaction:
62 CLOSE liahona;
63 COMMIT WORK;
64
65 Compatibility
66
67    There is no MOVE statement in the SQL standard.
68
69 See Also
70
71    CLOSE, DECLARE, FETCH