{"Entry":{"collection":"sql","key":"move","name":"MOVE","aliases":["move"],"metadata":{"aliases":["move"],"changed_in":["7.0","7.1","7.4","9.0","9.1","10"],"changes":[{"from":"6.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["usage"],"removed":[]},"status":"changed","synopsis":null,"to":"6.5"},{"from":"6.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","usage","compatibility"],"removed":[]},"status":"changed","synopsis":{"added":[],"removed":["FETCH [ RELATIVE ] [ { [ # | ALL | NEXT | PRIOR ] } ] FROM ] cursor"]},"to":"7.0"},{"from":"7.0","purpose_changed":false,"renamed":{"from_file":"sql-move.htm","to_file":"sql-move.html"},"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["MOVE [ direction ] [ count ]"],"removed":["MOVE [ selector ] [ count ]"]},"to":"7.1"},{"from":"7.1","purpose_changed":true,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"7.2"},{"from":"7.3","purpose_changed":true,"renamed":null,"sections":{"added":["outputs","examples"],"changed":["description","compatibility"],"removed":["usage"]},"status":"changed","synopsis":{"added":["MOVE [ direction { FROM | IN } ] cursorname"],"removed":["MOVE [ direction ] [ count ]","{ IN | FROM } cursor"]},"to":"7.4"},{"from":"7.4","purpose_changed":false,"renamed":null,"sections":{"added":["see_also"],"changed":["outputs"],"removed":[]},"status":"changed","synopsis":null,"to":"8.0"},{"from":"8.3","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"8.4"},{"from":"8.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["MOVE [ direction [ FROM | IN ] ] cursor_name"],"removed":["MOVE [ direction { FROM | IN } ] cursorname"]},"to":"9.0"},{"from":"9.0","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["NEXT","PRIOR","FIRST","LAST","ABSOLUTE count","RELATIVE count","count","ALL","FORWARD","FORWARD count","FORWARD ALL","BACKWARD","BACKWARD count","BACKWARD ALL"],"removed":[]},"to":"9.1"},{"from":"9.6","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["MOVE [ direction ] [ FROM | IN ] cursor_name"],"removed":["MOVE [ direction [ FROM | IN ] ] cursor_name"]},"to":"10"}],"content_hash":"9e1006a663e3dc5ea331d725b35ea21895e488ac900840a2fb7bec6485ba18c3","editorial":{},"first_version":"6.4","group":"cursor","imported_at":"2026-09-30T17:43:39.264706+08:00","last_version":"20","name":"MOVE","object":"","position":12005,"present_in":["6.4","6.5","7.0","7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"purpose":"position a cursor","purpose_zh":"","related":["close","declare","fetch"],"slug":"move","source_rev":"a709ab85","synopsis":"MOVE [ direction ] [ FROM | IN ] cursor_name\nwhere direction can be one of:\n\nNEXT\nPRIOR\nFIRST\nLAST\nABSOLUTE count\nRELATIVE count\ncount\nALL\nFORWARD\nFORWARD count\nFORWARD ALL\nBACKWARD\nBACKWARD count\nBACKWARD ALL","verb":"MOVE"}},"Definition":{"Collection":"sql","Key":"move","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"move","SourceRevision":"a709ab85","Facts":{"anchor":"SQL-MOVE","file":"sql-move.html","lang":"en","name":"MOVE","purpose":"position a cursor","purpose_zh":"","related":["close","declare","fetch"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eMOVE\u003c/code\u003e repositions a cursor without retrieving any data. \u003ccode class=\"command\"\u003eMOVE\u003c/code\u003e works exactly like the \u003ccode class=\"command\"\u003eFETCH\u003c/code\u003e command, except it only positions the cursor and does not return rows.\u003c/p\u003e\u003cp\u003eThe parameters for the \u003ccode class=\"command\"\u003eMOVE\u003c/code\u003e command are identical to those of the \u003ccode class=\"command\"\u003eFETCH\u003c/code\u003e command; refer to \u003ca href=\"/docs/18/sql-fetch.html\" title=\"FETCH\"\u003e\u003cspan class=\"refentrytitle\"\u003eFETCH\u003c/span\u003e\u003c/a\u003e for details on syntax and usage.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cp\u003eOn successful completion, a \u003ccode class=\"command\"\u003eMOVE\u003c/code\u003e command returns a command tag of the form\u003c/p\u003e\u003cpre class=\"screen\"\u003eMOVE \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n\u003c/pre\u003e\u003cp\u003eThe \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e is the number of rows that a \u003ccode class=\"command\"\u003eFETCH\u003c/code\u003e command with the same parameters would have returned (possibly zero).\u003c/p\u003e","key":"outputs","title":"Outputs"},{"html":"\u003cpre class=\"programlisting\"\u003eBEGIN WORK;\nDECLARE liahona CURSOR FOR SELECT * FROM films;\n\n-- Skip the first 5 rows:\nMOVE FORWARD 5 IN liahona;\nMOVE 5\n\n-- Fetch the 6th row from the cursor liahona:\nFETCH 1 FROM liahona;\n code  | title  | did | date_prod  |  kind  |  len\n-------+--------+-----+------------+--------+-------\n P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37\n(1 row)\n\n-- Close the cursor liahona and end the transaction:\nCLOSE liahona;\nCOMMIT WORK;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003eThere is no \u003ccode class=\"command\"\u003eMOVE\u003c/code\u003e statement in the SQL standard.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/close/?v=18\" title=\"CLOSE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCLOSE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/declare/?v=18\" title=\"DECLARE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDECLARE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/fetch/?v=18\" title=\"FETCH\"\u003e\u003cspan class=\"refentrytitle\"\u003eFETCH\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"MOVE [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirection\u003c/code\u003e\u003c/em\u003e ] [ FROM | IN ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecursor_name\u003c/code\u003e\u003c/em\u003e\n\n\u003cspan class=\"phrase\"\u003ewhere \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirection\u003c/code\u003e\u003c/em\u003e can be one of:\u003c/span\u003e\n\n    NEXT\n    PRIOR\n    FIRST\n    LAST\n    ABSOLUTE \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n    RELATIVE \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n    \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n    ALL\n    FORWARD\n    FORWARD \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n    FORWARD ALL\n    BACKWARD\n    BACKWARD \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n    BACKWARD ALL","synopsis_text":"MOVE [ direction ] [ FROM | IN ] cursor_name\nwhere direction can be one of:\n\nNEXT\nPRIOR\nFIRST\nLAST\nABSOLUTE count\nRELATIVE count\ncount\nALL\nFORWARD\nFORWARD count\nFORWARD ALL\nBACKWARD\nBACKWARD count\nBACKWARD ALL"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"move","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"MOVE","Summary":"定位游标","BodyHTML":"\u003cpre\u003eMOVE [ direction ] [ FROM | IN ] cursor_name\n其中 direction 可以是以下之一：\n\nNEXT\nPRIOR\nFIRST\nLAST\nABSOLUTE count\nRELATIVE count\ncount\nALL\nFORWARD\nFORWARD count\nFORWARD ALL\nBACKWARD\nBACKWARD count\nBACKWARD ALL\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eMOVE\u003c/code\u003e在不检索任何数据的情况下重新定位游标。\u003ccode\u003eMOVE\u003c/code\u003e与\u003ccode\u003eFETCH\u003c/code\u003e命令的工作方式完全相同，只是它只定位游标而不返回行。\u003c/p\u003e\u003cp\u003e\u003ccode\u003eMOVE\u003c/code\u003e命令的参数与\u003ccode\u003eFETCH\u003c/code\u003e命令完全相同；有关语法和用法的细节，请参阅\u003ca href=\"/docs/18/sql-fetch.html\" title=\"FETCH\" rel=\"nofollow\"\u003e\u003cspan\u003eFETCH\u003c/span\u003e\u003c/a\u003e。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e输出\u003c/h2\u003e\u003cp\u003e成功完成时，\u003ccode\u003eMOVE\u003c/code\u003e命令会返回如下形式的命令标签：\u003c/p\u003e\u003cpre\u003eMOVE \u003cem\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n\u003c/pre\u003e\u003cp\u003e其中\u003cem\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e是用相同参数执行 \u003ccode\u003eFETCH\u003c/code\u003e命令时本应返回的行数（可能为零）。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cpre\u003eBEGIN WORK;\nDECLARE liahona CURSOR FOR SELECT * FROM films;\n\n-- 跳过前 5 行：\nMOVE FORWARD 5 IN liahona;\nMOVE 5\n\n-- 从游标 liahona 中提取第 6 行：\nFETCH 1 FROM liahona;\n code  | title  | did | date_prod  |  kind  |  len\n-------+--------+-----+------------+--------+-------\n P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37\n(1 row)\n\n-- 关闭游标 liahona 并结束事务：\nCLOSE liahona;\nCOMMIT WORK;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003eSQL 标准中没有\u003ccode\u003eMOVE\u003c/code\u003e语句。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/close/?v=18\" title=\"CLOSE\" rel=\"nofollow\"\u003e\u003cspan\u003eCLOSE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/declare/?v=18\" title=\"DECLARE\" rel=\"nofollow\"\u003e\u003cspan\u003eDECLARE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/fetch/?v=18\" title=\"FETCH\" rel=\"nofollow\"\u003e\u003cspan\u003eFETCH\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"1b5ca64c","ContentHash":"d4bef2e1de33938d0adb2c049d1d6f4333395381c6974674d2385729ec37f038","Payload":{"purpose_zh":"定位游标","sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eMOVE\u003c/code\u003e在不检索任何数据的情况下重新定位游标。\u003ccode class=\"command\"\u003eMOVE\u003c/code\u003e与\u003ccode class=\"command\"\u003eFETCH\u003c/code\u003e命令的工作方式完全相同，只是它只定位游标而不返回行。\u003c/p\u003e\u003cp\u003e\u003ccode class=\"command\"\u003eMOVE\u003c/code\u003e命令的参数与\u003ccode class=\"command\"\u003eFETCH\u003c/code\u003e命令完全相同；有关语法和用法的细节，请参阅\u003ca href=\"/docs/18/sql-fetch.html\" title=\"FETCH\"\u003e\u003cspan class=\"refentrytitle\"\u003eFETCH\u003c/span\u003e\u003c/a\u003e。\u003c/p\u003e","key":"description","title":"描述"},{"html":"\u003cp\u003e成功完成时，\u003ccode class=\"command\"\u003eMOVE\u003c/code\u003e命令会返回如下形式的命令标签：\u003c/p\u003e\u003cpre class=\"screen\"\u003eMOVE \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n\u003c/pre\u003e\u003cp\u003e其中\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e是用相同参数执行 \u003ccode class=\"command\"\u003eFETCH\u003c/code\u003e命令时本应返回的行数（可能为零）。\u003c/p\u003e","key":"outputs","title":"输出"},{"html":"\u003cpre class=\"programlisting\"\u003eBEGIN WORK;\nDECLARE liahona CURSOR FOR SELECT * FROM films;\n\n-- 跳过前 5 行：\nMOVE FORWARD 5 IN liahona;\nMOVE 5\n\n-- 从游标 liahona 中提取第 6 行：\nFETCH 1 FROM liahona;\n code  | title  | did | date_prod  |  kind  |  len\n-------+--------+-----+------------+--------+-------\n P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37\n(1 row)\n\n-- 关闭游标 liahona 并结束事务：\nCLOSE liahona;\nCOMMIT WORK;\n\u003c/pre\u003e","key":"examples","title":"示例"},{"html":"\u003cp\u003eSQL 标准中没有\u003ccode class=\"command\"\u003eMOVE\u003c/code\u003e语句。\u003c/p\u003e","key":"compatibility","title":"兼容性"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/close/?v=18\" title=\"CLOSE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCLOSE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/declare/?v=18\" title=\"DECLARE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDECLARE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/fetch/?v=18\" title=\"FETCH\"\u003e\u003cspan class=\"refentrytitle\"\u003eFETCH\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"另见"}],"sections_same_as":"","synopsis_html":"MOVE [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirection\u003c/code\u003e\u003c/em\u003e ] [ FROM | IN ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecursor_name\u003c/code\u003e\u003c/em\u003e\n\n\u003cspan class=\"phrase\"\u003e其中 \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirection\u003c/code\u003e\u003c/em\u003e 可以是以下之一：\u003c/span\u003e\n\n    NEXT\n    PRIOR\n    FIRST\n    LAST\n    ABSOLUTE \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n    RELATIVE \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n    \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n    ALL\n    FORWARD\n    FORWARD \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n    FORWARD ALL\n    BACKWARD\n    BACKWARD \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\n    BACKWARD ALL","synopsis_text":"MOVE [ direction ] [ FROM | IN ] cursor_name\n其中 direction 可以是以下之一：\n\nNEXT\nPRIOR\nFIRST\nLAST\nABSOLUTE count\nRELATIVE count\ncount\nALL\nFORWARD\nFORWARD count\nFORWARD ALL\nBACKWARD\nBACKWARD count\nBACKWARD ALL"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","6.4","6.5","7.0","7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
