NAME
MOVE - 重定位一个游标
SYNOPSIS
MOVE [ direction { FROM | IN } ] cursorname
DESCRIPTION 描述
MOVE 在不检索数据的情况下重新定位一个游标。 MOVE ALL 把游标移动到结尾。 MOVE 的工作类似于 FETCH 命令, 但只是重定位游标而不返回行。
请参考 FETCH [fetch(7)] 命令获取语法和参数的详细信息。
OUTPUTS 输出
成功完成时,MOVE 命令返回一个下面形式的命令标签
MOVE count
count 是移动的行数(可能为零)。
EXAMPLES 例子
设置和使用一个游标:
BEGIN WORK; DECLARE liahona CURSOR FOR SELECT * FROM films; -- 忽略开头 5 行: MOVE FORWARD 5 IN liahona; MOVE 5 -- 抓取游标 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) -- 关闭游标 liahona 并提交工作: CLOSE liahona; COMMIT WORK;
#p#
NAME
MOVE - position a cursor
SYNOPSIS
MOVE [ direction { FROM | IN } ] cursorname
DESCRIPTION
MOVE repositions a cursor without retrieving any data. MOVE works exactly like the FETCH command, except it only positions the cursor and does not return rows.
Refer to FETCH [fetch(7)] for details on syntax and usage.
OUTPUTS
On successful completion, a MOVE command returns a command tag of the form
MOVE count
The count is the number of rows moved over (possibly zero).
EXAMPLES
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;