{"Entry":{"collection":"sql","key":"call","name":"CALL","aliases":["call"],"metadata":{"aliases":["call"],"changed_in":[],"changes":[{"from":"10","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"11"},{"from":"11","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes"],"removed":[]},"status":"changed","synopsis":null,"to":"12"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters","notes","compatibility"],"removed":[]},"status":"changed","synopsis":null,"to":"14"},{"from":"16","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes"],"removed":[]},"status":"changed","synopsis":null,"to":"17"}],"content_hash":"e0d48a023a2747676b98f7eb776aac40713f7bc6989969cae62b8ebdb2df8ebb","derived_content_hash":"36a1eaff0c40085a5d3de1d330141e2a205be1796e59d96d5c4e3f3081d88a81","editorial":{},"first_version":"11","group":"routine","imported_at":"2026-09-30T17:43:36.962955+08:00","last_version":"20","name":"CALL","object":"","position":2000,"present_in":["11","12","13","14","15","16","17","18","19","20"],"purpose":"invoke a procedure","purpose_zh":"","related":["create-procedure"],"repair_provenance":{"original_source_revision":"a709ab85","receipt_sha256":"075460df4adddc5cf56cc5a8981ad888ad5f4ecabf379c942be8b8e7652c5347","repair":"wiki-repair-20261023"},"slug":"call","source_rev":"wiki-repair-20261023:846b8256e433f58ac6673a73a514f3e1c37284191adff75ea325a1919ca741a1","synopsis":"CALL name ( [ argument ] [, ...] )","verb":"CALL"}},"Definition":{"Collection":"sql","Key":"call","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"call","SourceRevision":"wiki-repair-20261023:846b8256e433f58ac6673a73a514f3e1c37284191adff75ea325a1919ca741a1","Facts":{"anchor":"SQL-CALL","description_zh":"调用一个过程","description_zh_html":"\u003cpre\u003eCALL name ( [ argument ] [, ...] )\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eCALL\u003c/code\u003e 执行一个过程。\n  \u003c/p\u003e\u003cp\u003e\n   如果该过程有任何输出参数，则会返回一行结果，其中包含这些参数的值。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      过程的名称（可以是模式限定的）。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eargument\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      过程调用的参数表达式。\n     \u003c/p\u003e\u003cp\u003e\n      参数中可以包含参数名，使用语法\n      \u003ccode class=\"literal\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e =\u0026gt; \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e。这与普通函数调用中的工作方式相同；详见\u003ca class=\"xref\" href=\"/zh/docs/18/sql-syntax-calling-funcs.html\" title=\"4.3. 调用函数\"\u003e第 4.3 节\u003c/a\u003e。\n     \u003c/p\u003e\u003cp\u003e\n      对于所有没有默认值的过程参数，都必须提供参数，包括 \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e 参数。不过，与 \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e 参数匹配的实参不会被求值，因此通常只需写成 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。（如果为 \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e 参数写入其他内容，可能会与未来的 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 版本产生兼容性问题。）\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e注解\u003c/h2\u003e\u003cp\u003e\n   用户必须拥有该过程的 \u003ccode class=\"literal\"\u003eEXECUTE\u003c/code\u003e 权限，才能调用它。\n  \u003c/p\u003e\u003cp\u003e\n   若要调用函数（而不是过程），请改用 \u003ccode class=\"command\"\u003eSELECT\u003c/code\u003e。\n  \u003c/p\u003e\u003cp\u003e\n   如果在事务块中执行 \u003ccode class=\"command\"\u003eCALL\u003c/code\u003e，则被调用的过程不能执行事务控制语句。只有当 \u003ccode class=\"command\"\u003eCALL\u003c/code\u003e 作为独立事务执行时，才允许使用事务控制语句。\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003ePL/pgSQL\u003c/span\u003e 对 \u003ccode class=\"command\"\u003eCALL\u003c/code\u003e 命令中的输出参数采用不同的处理方式；参见\u003ca class=\"xref\" href=\"/zh/docs/18/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-CALLING-PROCEDURE\" title=\"41.6.3. 调用过程\"\u003e第 41.6.3 节\u003c/a\u003e。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cpre class=\"programlisting\"\u003e\nCALL do_db_maintenance();\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eCALL\u003c/code\u003e 符合 SQL 标准，但对输出参数的处理除外。标准规定用户应写变量来接收输出参数的值。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/zh/docs/18/sql-createprocedure.html\" title=\"CREATE PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE PROCEDURE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","file":"sql-call.html","lang":"en","name":"CALL","purpose":"invoke a procedure","purpose_zh":"调用一个过程","related":["create-procedure"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eCALL\u003c/code\u003e executes a procedure.\u003c/p\u003e\u003cp\u003eIf the procedure has any output parameters, then a result row will be returned, containing the values of those parameters.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the procedure.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eargument\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eAn argument expression for the procedure call.\u003c/p\u003e\u003cp\u003eArguments can include parameter names, using the syntax \u003ccode class=\"literal\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e =\u0026gt; \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e. This works the same as in ordinary function calls; see \u003ca href=\"/docs/18/sql-syntax-calling-funcs.html\" title=\"4.3. Calling Functions\"\u003eSection 4.3\u003c/a\u003e for details.\u003c/p\u003e\u003cp\u003eArguments must be supplied for all procedure parameters that lack defaults, including \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e parameters. However, arguments matching \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e parameters are not evaluated, so it's customary to just write \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e for them. (Writing something else for an \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e parameter might cause compatibility problems with future \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e versions.)\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eThe user must have \u003ccode class=\"literal\"\u003eEXECUTE\u003c/code\u003e privilege on the procedure in order to be allowed to invoke it.\u003c/p\u003e\u003cp\u003eTo call a function (not a procedure), use \u003ccode class=\"command\"\u003eSELECT\u003c/code\u003e instead.\u003c/p\u003e\u003cp\u003eIf \u003ccode class=\"command\"\u003eCALL\u003c/code\u003e is executed in a transaction block, then the called procedure cannot execute transaction control statements. Transaction control statements are only allowed if \u003ccode class=\"command\"\u003eCALL\u003c/code\u003e is executed in its own transaction.\u003c/p\u003e\u003cp\u003e\u003cspan class=\"application\"\u003ePL/pgSQL\u003c/span\u003e handles output parameters in \u003ccode class=\"command\"\u003eCALL\u003c/code\u003e commands differently; see \u003ca href=\"/docs/18/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-CALLING-PROCEDURE\" title=\"41.6.3. Calling a Procedure\"\u003eSection 41.6.3\u003c/a\u003e.\u003c/p\u003e","key":"notes","title":"Notes"},{"html":"\u003cpre class=\"programlisting\"\u003eCALL do_db_maintenance();\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eCALL\u003c/code\u003e conforms to the SQL standard, except for the handling of output parameters. The standard says that users should write variables to receive the values of output parameters.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/create-procedure/?v=18\" title=\"CREATE PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE PROCEDURE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"CALL \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e ( [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargument\u003c/code\u003e\u003c/em\u003e ] [, ...] )","synopsis_text":"CALL name ( [ argument ] [, ...] )","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-call.html","sha256":"0fe513e7673ca7bbfd2d68a6955f9664332af038dc2813fdf7fd6a5fc4a0f22a"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"call","SourceDatabase":"center","Version":"18","Locale":"en","Title":"CALL","Summary":"invoke a procedure","BodyHTML":"\u003cpre\u003eCALL name ( [ argument ] [, ...] )\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eCALL\u003c/code\u003e executes a procedure.\u003c/p\u003e\u003cp\u003eIf the procedure has any output parameters, then a result row will be returned, containing the values of those parameters.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eParameters\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the procedure.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003eargument\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eAn argument expression for the procedure call.\u003c/p\u003e\u003cp\u003eArguments can include parameter names, using the syntax \u003ccode\u003e\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e =\u0026gt; \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e. This works the same as in ordinary function calls; see \u003ca href=\"/docs/18/sql-syntax-calling-funcs.html\" rel=\"nofollow\"\u003eSection 4.3\u003c/a\u003e for details.\u003c/p\u003e\u003cp\u003eArguments must be supplied for all procedure parameters that lack defaults, including \u003ccode\u003eOUT\u003c/code\u003e parameters. However, arguments matching \u003ccode\u003eOUT\u003c/code\u003e parameters are not evaluated, so it\u0026#39;s customary to just write \u003ccode\u003eNULL\u003c/code\u003e for them. (Writing something else for an \u003ccode\u003eOUT\u003c/code\u003e parameter might cause compatibility problems with future \u003cspan\u003ePostgreSQL\u003c/span\u003e versions.)\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cp\u003eThe user must have \u003ccode\u003eEXECUTE\u003c/code\u003e privilege on the procedure in order to be allowed to invoke it.\u003c/p\u003e\u003cp\u003eTo call a function (not a procedure), use \u003ccode\u003eSELECT\u003c/code\u003e instead.\u003c/p\u003e\u003cp\u003eIf \u003ccode\u003eCALL\u003c/code\u003e is executed in a transaction block, then the called procedure cannot execute transaction control statements. Transaction control statements are only allowed if \u003ccode\u003eCALL\u003c/code\u003e is executed in its own transaction.\u003c/p\u003e\u003cp\u003e\u003cspan\u003ePL/pgSQL\u003c/span\u003e handles output parameters in \u003ccode\u003eCALL\u003c/code\u003e commands differently; see \u003ca href=\"/docs/18/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-CALLING-PROCEDURE\" rel=\"nofollow\"\u003eSection 41.6.3\u003c/a\u003e.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cpre\u003eCALL do_db_maintenance();\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eCALL\u003c/code\u003e conforms to the SQL standard, except for the handling of output parameters. The standard says that users should write variables to receive the values of output parameters.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/create-procedure/?v=18\" title=\"CREATE PROCEDURE\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE PROCEDURE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:846b8256e433f58ac6673a73a514f3e1c37284191adff75ea325a1919ca741a1","ContentHash":"b62c518c26aa4e1e601d2e52316e1d286436df71e52737ee3a0eaa919891efb4","Payload":{"related":["create-procedure"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eCALL\u003c/code\u003e executes a procedure.\u003c/p\u003e\u003cp\u003eIf the procedure has any output parameters, then a result row will be returned, containing the values of those parameters.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the procedure.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eargument\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eAn argument expression for the procedure call.\u003c/p\u003e\u003cp\u003eArguments can include parameter names, using the syntax \u003ccode class=\"literal\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e =\u0026gt; \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e. This works the same as in ordinary function calls; see \u003ca href=\"/docs/18/sql-syntax-calling-funcs.html\" title=\"4.3. Calling Functions\"\u003eSection 4.3\u003c/a\u003e for details.\u003c/p\u003e\u003cp\u003eArguments must be supplied for all procedure parameters that lack defaults, including \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e parameters. However, arguments matching \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e parameters are not evaluated, so it's customary to just write \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e for them. (Writing something else for an \u003ccode class=\"literal\"\u003eOUT\u003c/code\u003e parameter might cause compatibility problems with future \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e versions.)\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eThe user must have \u003ccode class=\"literal\"\u003eEXECUTE\u003c/code\u003e privilege on the procedure in order to be allowed to invoke it.\u003c/p\u003e\u003cp\u003eTo call a function (not a procedure), use \u003ccode class=\"command\"\u003eSELECT\u003c/code\u003e instead.\u003c/p\u003e\u003cp\u003eIf \u003ccode class=\"command\"\u003eCALL\u003c/code\u003e is executed in a transaction block, then the called procedure cannot execute transaction control statements. Transaction control statements are only allowed if \u003ccode class=\"command\"\u003eCALL\u003c/code\u003e is executed in its own transaction.\u003c/p\u003e\u003cp\u003e\u003cspan class=\"application\"\u003ePL/pgSQL\u003c/span\u003e handles output parameters in \u003ccode class=\"command\"\u003eCALL\u003c/code\u003e commands differently; see \u003ca href=\"/docs/18/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-CALLING-PROCEDURE\" title=\"41.6.3. Calling a Procedure\"\u003eSection 41.6.3\u003c/a\u003e.\u003c/p\u003e","key":"notes","title":"Notes"},{"html":"\u003cpre class=\"programlisting\"\u003eCALL do_db_maintenance();\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eCALL\u003c/code\u003e conforms to the SQL standard, except for the handling of output parameters. The standard says that users should write variables to receive the values of output parameters.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/create-procedure/?v=18\" title=\"CREATE PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE PROCEDURE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"CALL \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e ( [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eargument\u003c/code\u003e\u003c/em\u003e ] [, ...] )","synopsis_text":"CALL name ( [ argument ] [, ...] )"}},"RequestedLocale":"en","Fallback":false,"Versions":["11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
