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

77 行
5.8KB

  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>dblink_fetch</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="contrib-dblink-open.html" title="dblink_open" /><link rel="next" href="contrib-dblink-close.html" title="dblink_close" /></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">dblink_fetch</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="contrib-dblink-open.html" title="dblink_open">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="dblink.html" title="F.10. dblink">Up</a></td><th width="60%" align="center">F.10. dblink</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="contrib-dblink-close.html" title="dblink_close">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="CONTRIB-DBLINK-FETCH"><div class="titlepage"></div><a id="id-1.11.7.19.11.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">dblink_fetch</span></h2><p>dblink_fetch — returns rows from an open cursor in a remote database</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
  3. dblink_fetch(text cursorname, int howmany [, bool fail_on_error]) returns setof record
  4. dblink_fetch(text connname, text cursorname, int howmany [, bool fail_on_error]) returns setof record
  5. </pre></div><div class="refsect1" id="id-1.11.7.19.11.5"><h2>Description</h2><p>
  6. <code class="function">dblink_fetch</code> fetches rows from a cursor previously
  7. established by <code class="function">dblink_open</code>.
  8. </p></div><div class="refsect1" id="id-1.11.7.19.11.6"><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>connname</code></em></span></dt><dd><p>
  9. Name of the connection to use; omit this parameter to use the
  10. unnamed connection.
  11. </p></dd><dt><span class="term"><em class="parameter"><code>cursorname</code></em></span></dt><dd><p>
  12. The name of the cursor to fetch from.
  13. </p></dd><dt><span class="term"><em class="parameter"><code>howmany</code></em></span></dt><dd><p>
  14. The maximum number of rows to retrieve. The next <em class="parameter"><code>howmany</code></em>
  15. rows are fetched, starting at the current cursor position, moving
  16. forward. Once the cursor has reached its end, no more rows are produced.
  17. </p></dd><dt><span class="term"><em class="parameter"><code>fail_on_error</code></em></span></dt><dd><p>
  18. If true (the default when omitted) then an error thrown on the
  19. remote side of the connection causes an error to also be thrown
  20. locally. If false, the remote error is locally reported as a NOTICE,
  21. and the function returns no rows.
  22. </p></dd></dl></div></div><div class="refsect1" id="id-1.11.7.19.11.7"><h2>Return Value</h2><p>
  23. The function returns the row(s) fetched from the cursor. To use this
  24. function, you will need to specify the expected set of columns,
  25. as previously discussed for <code class="function">dblink</code>.
  26. </p></div><div class="refsect1" id="id-1.11.7.19.11.8"><h2>Notes</h2><p>
  27. On a mismatch between the number of return columns specified in the
  28. <code class="literal">FROM</code> clause, and the actual number of columns returned by the
  29. remote cursor, an error will be thrown. In this event, the remote cursor
  30. is still advanced by as many rows as it would have been if the error had
  31. not occurred. The same is true for any other error occurring in the local
  32. query after the remote <code class="command">FETCH</code> has been done.
  33. </p></div><div class="refsect1" id="id-1.11.7.19.11.9"><h2>Examples</h2><pre class="screen">
  34. SELECT dblink_connect('dbname=postgres options=-csearch_path=');
  35. dblink_connect
  36. ----------------
  37. OK
  38. (1 row)
  39. SELECT dblink_open('foo', 'select proname, prosrc from pg_proc where proname like ''bytea%''');
  40. dblink_open
  41. -------------
  42. OK
  43. (1 row)
  44. SELECT * FROM dblink_fetch('foo', 5) AS (funcname name, source text);
  45. funcname | source
  46. ----------+----------
  47. byteacat | byteacat
  48. byteacmp | byteacmp
  49. byteaeq | byteaeq
  50. byteage | byteage
  51. byteagt | byteagt
  52. (5 rows)
  53. SELECT * FROM dblink_fetch('foo', 5) AS (funcname name, source text);
  54. funcname | source
  55. -----------+-----------
  56. byteain | byteain
  57. byteale | byteale
  58. bytealike | bytealike
  59. bytealt | bytealt
  60. byteane | byteane
  61. (5 rows)
  62. SELECT * FROM dblink_fetch('foo', 5) AS (funcname name, source text);
  63. funcname | source
  64. ------------+------------
  65. byteanlike | byteanlike
  66. byteaout | byteaout
  67. (2 rows)
  68. SELECT * FROM dblink_fetch('foo', 5) AS (funcname name, source text);
  69. funcname | source
  70. ----------+--------
  71. (0 rows)
  72. </pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="contrib-dblink-open.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="dblink.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="contrib-dblink-close.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">dblink_open </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> dblink_close</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1