postgresql plpgsql:调用带有 2 个 OUT 参数的函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10584002/
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
plpgsql: calling a function with 2 OUT parameters
提问by marco
I'm trying to fetch to values from a plpgsql function with 2 OUT paramenters but I have some problem.
我正在尝试从带有 2 个 OUT 参数的 plpgsql 函数中获取值,但我遇到了一些问题。
These are the functions:
这些是函数:
CREATE OR REPLACE FUNCTION get_test(OUT x text, OUT y text)
AS $$
BEGIN
x := 1;
y := 2;
END;
$$ LANGUAGE plpgsql;
----------------------------------------------------------------
CREATE OR REPLACE FUNCTION get_test_read()
RETURNS VOID AS $$
DECLARE
xx text;
yy text;
BEGIN
SELECT get_test() INTO xx, yy;
RAISE INFO 'x: <%>', xx;
RAISE INFO 'y: <%>', yy;
END;
$$ LANGUAGE plpgsql;
The output of the command:
命令的输出:
select get_test_read();
INFO: x: <(1,2)
INFO: y: <>
get_test_read
选择 get_test_read();
信息:x:<(1,2)
信息:y:<>
get_test_read
So both the values go to the first parameter. I cannot find some example on how to call a function like this.
所以这两个值都转到第一个参数。我找不到一些关于如何调用这样的函数的例子。