PostgreSQL 中类似存储过程的简单函数?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9434833/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-20 23:39:56  来源:igfitidea点击:

Simple stored procedure-like function in PostgreSQL?

postgresqlstored-procedurespostgresql-9.1

提问by n8gard

I want to create a function in pgsql that will take three parameters and return a single value (1 row, 1 col).

我想在 pgsql 中创建一个函数,它将接受三个参数并返回一个值(1 行,1 列)。

I have the query working but can not seem to find a proper example of creating a function to do this.

我有查询工作,但似乎无法找到创建函数来执行此操作的正确示例。

回答by Karlson

Take a look at the example on this page, or this one.

看看这个页面上的例子,或者这个

If you actually go through the documentation there are multiple example of various functions and return types.

如果您实际阅读文档,则有多种函数和返回类型的示例。