summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/man7/MOVE.7
blob: b0d15b1aa9935dfefd964b50d162207e685c436e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
'\" t
.\"     Title: MOVE
.\"    Author: The PostgreSQL Global Development Group
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 2024
.\"    Manual: PostgreSQL 15.6 Documentation
.\"    Source: PostgreSQL 15.6
.\"  Language: English
.\"
.TH "MOVE" "7" "2024" "PostgreSQL 15.6" "PostgreSQL 15.6 Documentation"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
MOVE \- position a cursor
.SH "SYNOPSIS"
.sp
.nf
MOVE [ \fIdirection\fR ] [ FROM | IN ] \fIcursor_name\fR

where \fIdirection\fR can be one of:

    NEXT
    PRIOR
    FIRST
    LAST
    ABSOLUTE \fIcount\fR
    RELATIVE \fIcount\fR
    \fIcount\fR
    ALL
    FORWARD
    FORWARD \fIcount\fR
    FORWARD ALL
    BACKWARD
    BACKWARD \fIcount\fR
    BACKWARD ALL
.fi
.SH "DESCRIPTION"
.PP
\fBMOVE\fR
repositions a cursor without retrieving any data\&.
\fBMOVE\fR
works exactly like the
\fBFETCH\fR
command, except it only positions the cursor and does not return rows\&.
.PP
The parameters for the
\fBMOVE\fR
command are identical to those of the
\fBFETCH\fR
command; refer to
\fBFETCH\fR(7)
for details on syntax and usage\&.
.SH "OUTPUTS"
.PP
On successful completion, a
\fBMOVE\fR
command returns a command tag of the form
.sp
.if n \{\
.RS 4
.\}
.nf
MOVE \fIcount\fR
.fi
.if n \{\
.RE
.\}
.sp
The
\fIcount\fR
is the number of rows that a
\fBFETCH\fR
command with the same parameters would have returned (possibly zero)\&.
.SH "EXAMPLES"
.sp
.if n \{\
.RS 4
.\}
.nf
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;
.fi
.if n \{\
.RE
.\}
.SH "COMPATIBILITY"
.PP
There is no
\fBMOVE\fR
statement in the SQL standard\&.
.SH "SEE ALSO"
\fBCLOSE\fR(7), \fBDECLARE\fR(7), \fBFETCH\fR(7)