[英]How to pass TEXT Array [ ] to a postgres function?
I have this function which has been translated from oracle to postgres:我有这个 function 已从 oracle 翻译为 postgres:
CREATE OR REPLACE FUNCTION myblah ( values TEXT[], evalues TEXT[], p_pid bigint, c_id bigint, pr_id bigint, p_name TEXT, p_use text default 'N')
RETURNS VOID
AS $body$
and I am trying to call this function in order to test.我试图调用这个 function 来测试。 But I am having issue inserting the array parameter, unsure of the syntax and cannot find anything to show me.
但是我在插入数组参数时遇到问题,不确定语法并且找不到任何东西给我看。
for example I am trying this but it is not acceptable syntax:例如我正在尝试这个,但它是不可接受的语法:
select myblah (TEXT['hello','whynot','jasmine'], 43423, 434234,534534,'fggffgfg','N');
the error is错误是
ERROR: syntax error at or near ","
LINE 1: select myblah(TEXT['hello','whynot','jasmin...
however removing the ',' does not work但是删除“,”不起作用
As the documentation will tell you, there are two options:正如文档将告诉您的那样,有两种选择:
'{string 1,string 2}'
or或者
ARRAY['string1', 'string 2']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.