MOVE

Name

MOVE -- 定位一个游标

Synopsis

MOVE [ _direction_ [ FROM | IN ] ] _cursor_name_

where `_direction_` can be empty or one of:

    NEXT
    PRIOR
    FIRST
    LAST
    ABSOLUTE _count_
    RELATIVE _count_
    _count_
    ALL
    FORWARD
    FORWARD _count_
    FORWARD ALL
    BACKWARD
    BACKWARD _count_
    BACKWARD ALL

描述

MOVE在不检索数据的情况下重新定位一个游标。MOVE 的工作类似于FETCH命令,但只是重定位游标而不返回行。

MOVE命令的参数与FETCH命令的参数相同; 请参考FETCH命令获取语法和参数的详细信息。

输出

成功完成时,MOVE命令将返回一个下面形式的命令标签

MOVE _count_

_count_是一个带同参数的FETCH 命令会返回的行数(可能为零)。

例子

BEGIN WORK;
DECLARE liahona CURSOR FOR SELECT * FROM films;

 -- 忽略开头5行:

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)

-- 关闭游标liahona并提交事务:
CLOSE liahona;
COMMIT WORK;

兼容性

SQL 标准里没有MOVE语句。

又见

CLOSE, DECLARE, FETCH