gooderp18绿色标准版
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

59 行
4.9KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>MOVE</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="sql-lock.html" title="LOCK" /><link rel="next" href="sql-notify.html" title="NOTIFY" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">MOVE</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-lock.html" title="LOCK">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-notify.html" title="NOTIFY">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="SQL-MOVE"><div class="titlepage"></div><a id="id-1.9.3.156.1" class="indexterm"></a><a id="id-1.9.3.156.2" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">MOVE</span></h2><p>MOVE — position a cursor</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
  3. MOVE [ <em class="replaceable"><code>direction</code></em> [ FROM | IN ] ] <em class="replaceable"><code>cursor_name</code></em>
  4. <span class="phrase">where <em class="replaceable"><code>direction</code></em> can be empty or one of:</span>
  5. NEXT
  6. PRIOR
  7. FIRST
  8. LAST
  9. ABSOLUTE <em class="replaceable"><code>count</code></em>
  10. RELATIVE <em class="replaceable"><code>count</code></em>
  11. <em class="replaceable"><code>count</code></em>
  12. ALL
  13. FORWARD
  14. FORWARD <em class="replaceable"><code>count</code></em>
  15. FORWARD ALL
  16. BACKWARD
  17. BACKWARD <em class="replaceable"><code>count</code></em>
  18. BACKWARD ALL
  19. </pre></div><div class="refsect1" id="id-1.9.3.156.6"><h2>Description</h2><p>
  20. <code class="command">MOVE</code> repositions a cursor without retrieving any data.
  21. <code class="command">MOVE</code> works exactly like the <code class="command">FETCH</code>
  22. command, except it only positions the cursor and does not return rows.
  23. </p><p>
  24. The parameters for the <code class="command">MOVE</code> command are identical to
  25. those of the <code class="command">FETCH</code> command; refer to
  26. <a class="xref" href="sql-fetch.html" title="FETCH"><span class="refentrytitle">FETCH</span></a>
  27. for details on syntax and usage.
  28. </p></div><div class="refsect1" id="id-1.9.3.156.7"><h2>Outputs</h2><p>
  29. On successful completion, a <code class="command">MOVE</code> command returns a command
  30. tag of the form
  31. </p><pre class="screen">
  32. MOVE <em class="replaceable"><code>count</code></em>
  33. </pre><p>
  34. The <em class="replaceable"><code>count</code></em> is the number
  35. of rows that a <code class="command">FETCH</code> command with the same parameters
  36. would have returned (possibly zero).
  37. </p></div><div class="refsect1" id="id-1.9.3.156.8"><h2>Examples</h2><pre class="programlisting">
  38. BEGIN WORK;
  39. DECLARE liahona CURSOR FOR SELECT * FROM films;
  40. -- Skip the first 5 rows:
  41. MOVE FORWARD 5 IN liahona;
  42. MOVE 5
  43. -- Fetch the 6th row from the cursor liahona:
  44. FETCH 1 FROM liahona;
  45. code | title | did | date_prod | kind | len
  46. -------+--------+-----+------------+--------+-------
  47. P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37
  48. (1 row)
  49. -- Close the cursor liahona and end the transaction:
  50. CLOSE liahona;
  51. COMMIT WORK;
  52. </pre></div><div class="refsect1" id="id-1.9.3.156.9"><h2>Compatibility</h2><p>
  53. There is no <code class="command">MOVE</code> statement in the SQL standard.
  54. </p></div><div class="refsect1" id="id-1.9.3.156.10"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-close.html" title="CLOSE"><span class="refentrytitle">CLOSE</span></a>, <a class="xref" href="sql-declare.html" title="DECLARE"><span class="refentrytitle">DECLARE</span></a>, <a class="xref" href="sql-fetch.html" title="FETCH"><span class="refentrytitle">FETCH</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-lock.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-notify.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">LOCK </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> NOTIFY</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1