]> begriffs open source - ai-pg/blob - full-docs/man7/MOVE.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / MOVE.7
1 '\" t
2 .\"     Title: MOVE
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "MOVE" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 MOVE \- position a cursor
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 MOVE [ \fIdirection\fR ] [ FROM | IN ] \fIcursor_name\fR
36
37 where \fIdirection\fR can be one of:
38
39     NEXT
40     PRIOR
41     FIRST
42     LAST
43     ABSOLUTE \fIcount\fR
44     RELATIVE \fIcount\fR
45     \fIcount\fR
46     ALL
47     FORWARD
48     FORWARD \fIcount\fR
49     FORWARD ALL
50     BACKWARD
51     BACKWARD \fIcount\fR
52     BACKWARD ALL
53 .fi
54 .SH "DESCRIPTION"
55 .PP
56 \fBMOVE\fR
57 repositions a cursor without retrieving any data\&.
58 \fBMOVE\fR
59 works exactly like the
60 \fBFETCH\fR
61 command, except it only positions the cursor and does not return rows\&.
62 .PP
63 The parameters for the
64 \fBMOVE\fR
65 command are identical to those of the
66 \fBFETCH\fR
67 command; refer to
68 \fBFETCH\fR(7)
69 for details on syntax and usage\&.
70 .SH "OUTPUTS"
71 .PP
72 On successful completion, a
73 \fBMOVE\fR
74 command returns a command tag of the form
75 .sp
76 .if n \{\
77 .RS 4
78 .\}
79 .nf
80 MOVE \fIcount\fR
81 .fi
82 .if n \{\
83 .RE
84 .\}
85 .sp
86 The
87 \fIcount\fR
88 is the number of rows that a
89 \fBFETCH\fR
90 command with the same parameters would have returned (possibly zero)\&.
91 .SH "EXAMPLES"
92 .sp
93 .if n \{\
94 .RS 4
95 .\}
96 .nf
97 BEGIN WORK;
98 DECLARE liahona CURSOR FOR SELECT * FROM films;
99
100 \-\- Skip the first 5 rows:
101 MOVE FORWARD 5 IN liahona;
102 MOVE 5
103
104 \-\- Fetch the 6th row from the cursor liahona:
105 FETCH 1 FROM liahona;
106  code  | title  | did | date_prod  |  kind  |  len
107 \-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-
108  P_303 | 48 Hrs | 103 | 1982\-10\-22 | Action | 01:37
109 (1 row)
110
111 \-\- Close the cursor liahona and end the transaction:
112 CLOSE liahona;
113 COMMIT WORK;
114 .fi
115 .if n \{\
116 .RE
117 .\}
118 .SH "COMPATIBILITY"
119 .PP
120 There is no
121 \fBMOVE\fR
122 statement in the SQL standard\&.
123 .SH "SEE ALSO"
124 \fBCLOSE\fR(7), \fBDECLARE\fR(7), \fBFETCH\fR(7)