当前位置:网站首页>Parameter transfer format when the parameter of PostgreSQL function is a user-defined type
Parameter transfer format when the parameter of PostgreSQL function is a user-defined type
2022-06-11 03:36:00 【Full of grain】
Custom type
CREATE TYPE test_type_input AS (
id integer,
name character varying(200)
);Custom function
CREATE OR REPLACE FUNCTION public.test_function(
in_pro_arr test_type_input[],
OUT pro_len integer,
OUT out_name character varying[])
RETURNS record
LANGUAGE 'plpgsql'
COST 100
VOLATILE
AS $BODY$
DECLARE
loop_index integer;
pro_info record;
arr_length integer;
BEGIN
IF in_pro_arr is null or cardinality(in_pro_arr) <= 0 then
pro_len = -1;
out_name = null;
return;
END IF;
loop_index = 1;
arr_length = array_length(in_pro_arr,1);
pro_len = arr_length;
LOOP
pro_info = in_pro_arr[loop_index];
out_name[loop_index] = pro_info.name;
loop_index = loop_index + 1;
IF loop_index > arr_length THEN
exit;
END IF;
END LOOP;
END;
$BODY$;Function call example
SELECT * from test_function(
array[
(1, ' The computer '),
(2, ' Book '),
(3, ' Water glass ')
]::test_type_input[]
);边栏推荐
- /10个值得推荐的学习编程的网站 世界已经进入了互联网的时代。据最近发布的一篇《2016年互联网趋势》报告显示,中国已成为互联网市场的领导者,中国互联网用户的数量达到了6.68亿。可以预见,有
- R bioinformatics statistical analysis
- Integrated MP code generator
- postgresql 函数的参数为自定义类型时传参格式
- The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received
- canvas+svg线条粒子动画网页背景
- 正则表达式
- B_ QuRT_ User_ Guide(17)
- PostgreSQL source code learning (17) -- mvcc ② - Introduction to snapshot and isolation level
- 2022 年 5 月产品大事记
猜你喜欢

Checkbox beautify button selected style
![[safety science popularization] mining technology starts from the love story of a man of science and Engineering](/img/01/73376c133c33527e479685f8680238.jpg)
[safety science popularization] mining technology starts from the love story of a man of science and Engineering

Xu Li 618, how can Suning fight this hard battle?

Canvas rotation drawing H5 animation JS effect

Unity's data persistence -- Jason

一文搞懂单片机驱动8080LCD

多线程四部曲之NSThread

canvas+svg线条粒子动画网页背景
![[safety science popularization] have you been accepted by social workers today?](/img/ac/a6d2aa48219d02d82240d2f5343f19.jpg)
[safety science popularization] have you been accepted by social workers today?

Iqoo 8 measured hands-on experience: return of the king, never high profile
随机推荐
JS top icon menu click to switch background color JS special effect
rt-thread测试
If the source code of the home page module is not separated ----- > nanny level source code analysis (1)
window10安装keras
Gd32 can sends no mailbox fault
openssl enc 加解密
Unity's data persistence -- Jason
PostgreSQL source code learning (18) -- mvcc ③ - creating (obtaining) snapshots
【ELT.ZIP】OpenHarmony啃论文俱乐部——电子设备软件更新压缩
單片機通信數據延遲問題排查
实现发布订阅模式-----手撕js系列
Why is vfly, a high-end brand of Yadi that does not live up to its name, not high-end?
Picking peaches (double pointer)
Simple image browsing with fragment
js顶部图标菜单点击切换背景色js特效
基于SSM框架的连锁超市购物零售后台管理系统
postgresql copy语句
/The world of 10 recommended websites for learning programming has entered the era of the Internet. According to a recently released Internet trends 2016 report, China has become a leader in the Inter
postgresql 语句
WEB上传文件预览