VARIADIC参数必须是最后一个输入参数 [英] VARIADIC parameter must be the last input parameter

查看:63
本文介绍了VARIADIC参数必须是最后一个输入参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建两个VARIADIC参数.看我的代码并纠正我.

How to create two VARIADIC parameters. Look at my code and correct me.

CREATE OR REPLACE FUNCTION ip_source_test(text,text,date,date,VARIADIC int[],VARIADIC text[])
RETURNS TABLE (no_documents int, "Report By" text, "Report_By" text) AS 
$$
BEGIN
IF 'Source Member' = $1 THEN
RETURN QUERY SELECT.....
ELSEIF 'company' = $1 THEN
RETURN QUERY SELECT.....
ELSE
RAISE NOTICE 'Not Worked';
END IF;
RETURN;
END;
$$ LANGUAGE plpgsql;

Error: VARIADIC parameter must be the last input parameter.

在SQL代码中,我应该使用6个参数.请用示例代码向我更新.

In SQL code im supposed to use 6 parameters. Please update me with sample code.

推荐答案

就像错误消息告诉您的那样:

Just as the error message tells you:

VARIADIC参数必须是最后一个输入参数.

VARIADIC parameter must be the last input parameter.

从逻辑上讲,函数只能将单个VARIADIC参数作为最后一个参数.在该参数之前 可能还有其他(非VARIADIC)参数. 在此引用手册:

It follows logically that a function can only take a single VARIADIC parameter as last parameter. There can be other (non-VARIADIC) parameters before that one. Quoting the manual here:

有效地,所有在VARIADIC或更高位置的实际参数 位置收集成一维数组

Effectively, all the actual arguments at or beyond the VARIADIC position are gathered up into a one-dimensional array

这篇关于VARIADIC参数必须是最后一个输入参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆