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命令获取语法和参数的详细信息。
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;