当前位置:网站首页>Implementation of decode function in GP
Implementation of decode function in GP
2022-06-21 17:20:00 【MyySophia】
oracle There is one of them. decodde function , The students like it very much . from Oracle Migrate to GP when , If there is decode , There will be fewer code changes
The following is a GP Of decode Realization
create or replace function pg_catalog.decode(variadic p_decode_list text[])
returns text as
$$
declare
v_len integer := array_length(p_decode_list, 1);
v_ret text;
begin
if v_len >= 3 then
for i in 2..(v_len - 1) loop
v_ret := null;
if mod(i, 2) = 0 then
if p_decode_list[1] = p_decode_list[i] then
v_ret := p_decode_list[i+1];
elsif p_decode_list[1] <> p_decode_list[i] then
if v_len = i + 2 and v_len > 3 then
v_ret := p_decode_list[v_len];
end if;
end if;
end if;
exit when v_ret is not null;
end loop;
else
raise exception 'UPG-00938: not enough args for function.';
end if;
return v_ret;
end;
$$
language plpgsql;边栏推荐
- Concept drift in machine learning (Apria)
- The beta version of move protocol is stable, and it is temporarily decided to expand the scale of the prize pool
- Machine learning model monitoring (Apria)
- 【SQLite】解决unrecognized token:“‘“
- 【观察】微软“云+端”全面创新,让混合云更简单、更灵活、更安全
- Postman basic operations
- 使用unittest框架生成测试报告
- NLog自定义Target之MQTT
- 《网络是怎么样连接的》读书笔记 - FTTH
- How to judge DNS resolution failure? How to resolve DNS resolution errors?
猜你喜欢

Pytest framework

2022年第三届全国运筹学/数据、模型与决策课程教学研讨会通知

Recruitment order | data visualization development platform "flyfish" and "super experience officer" are recruited!

Pytest framework implements pre post processing
![[ROS2 基础] Navigation2 导航系统介绍](/img/7f/ad6af972460d7a78fb28d9b4c24477.png)
[ROS2 基础] Navigation2 导航系统介绍

使用PicGo-Core 和 阿里云 实现typora图片自动上传

使用unittest框架生成测试报告

Cloud native hybrid cloud network interconnection

The first atlas showing the development history of the database in China was officially released!
![[observation] Microsoft's](/img/70/c598ef50a4c06f9bdcb7a935dbf62b.png)
[observation] Microsoft's "cloud + end" comprehensive innovation makes hybrid cloud simpler, more flexible and more secure
随机推荐
Qtcreator error reporting solution
设计一个打印整棵树的打印函数
rtmp webrtc 协议 openssl 等安装
Concept drift in machine learning (Apria)
Come and watch – tpt18 new report
Three color mark removal method
很多软件公司,其实都是“笑话”
期货农产品开户怎么开?手续费是多少?
面向流动人口管理的人脸验证系统设计及实现 论文+答辩PPT+项目工程文件
Fidder tool usage notes
为什么要做茶叶商城小程序app开发?
Fisher信息量检测对抗样本代码详解
Online JSON to yaml tool
【1108. IP 地址無效化】
之前的装机记录
[1108. IP address invalidation]
In 2021 database market, aerospike competes with top manufacturers
很多軟件公司,其實都是“笑話”
海外new things | 美国人工智能初创「Zoovu」新一轮融资1.69亿美元,为消费者优化线上的“产品发现”体验
[SQLite] résoudre le jeton non enregistré: ''