Skip to content

MOVE

MOVE — 定位游标

语法

MOVE [ direction ] [ FROM | IN ] cursor_name

where direction can be 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;

-- 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;

兼容性

SQL 标准中没有MOVE语句。

另请参见

CLOSEDECLAREFETCH