当前位置:网站首页>[postgresql]postgresql custom function returns an instance of table type
[postgresql]postgresql custom function returns an instance of table type
2022-07-03 20:13:00 【just-do-it-zzj】
CREATE OR REPLACE function test_retable(p_id int)
RETURNS table(id int, name VARCHAR2(50))
LANGUAGE PLPGSQL
AS $$
DECLARE
/*
1. Create table
create table test1(c1 int ,c2 varchar2(50));
insert into test1(c1,c2) values(1,'2');
insert into test1(c1,c2) values(2,'2');
insert into test1(c1,c2) values(1,'3');
2. Execute query function
select * from test_retable(1);
*/
TYPE varray_type IS VARRAY(20) OF INT;
v_varray varray_type;
BEGIN
v_varray := varray_type(1, 2, 3, 4, 5);
RETURN QUERY SELECT c1 AS id, c2 AS name FROM test1 WHERE c1 in (
select regexp_split_to_table(array_to_string(v_varray, ','),',')
);
END ; $$
边栏推荐
- Gym welcomes the first complete environmental document, which makes it easier to get started with intensive learning!
- Rd file name conflict when extending a S4 method of some other package
- Micro service knowledge sorting - three pieces of micro Service Technology
- Promethus
- Global and Chinese market of high purity copper foil 2022-2028: Research Report on technology, participants, trends, market size and share
- The 29th day of force deduction (DP topic)
- Camera calibration (I): robot hand eye calibration
- BOC protected alanine porphyrin compound TAPP ala BOC BOC BOC protected phenylalanine porphyrin compound TAPP Phe BOC Qi Yue supply
- Phpstudy set LAN access
- QT tutorial: signal and slot mechanism
猜你喜欢
kubernetes集群搭建efk日志收集平台
Machine learning support vector machine SVM
Kubernetes cluster builds efk log collection platform
Change deepin to Alibaba image source
Camera calibration (I): robot hand eye calibration
2.1 use of variables
Commands related to files and directories
FPGA learning notes: vivado 2019.1 project creation
44. Concurrent programming theory
Battle drag method 1: moderately optimistic, build self-confidence (1)
随机推荐
Global and Chinese market of liquid antifreeze 2022-2028: Research Report on technology, participants, trends, market size and share
Detailed and not wordy. Share the win10 tutorial of computer reinstallation system
Network security Kali penetration learning how to get started with web penetration how to scan based on nmap
AST (Abstract Syntax Tree)
Fingerprint password lock based on Hal Library
CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析
4. Data splitting of Flink real-time project
kubernetes集群搭建efk日志收集平台
Titles can only be retrieved in PHP via curl - header only retrieval in PHP via curl
Kubernetes cluster builds efk log collection platform
Derivation of decision tree theory
Nerfplusplus parameter format sorting
Micro service knowledge sorting - asynchronous communication technology
[Yu Yue education] basic reference materials of manufacturing technology of Shanghai Jiaotong University
How can the outside world get values when using nodejs to link MySQL
MySQL learning notes - single table query
Use of CMD command
Teach you how to quickly recover data by deleting recycle bin files by mistake
Get log4net log file in C - get log4net log file in C
Microservice knowledge sorting - search technology and automatic deployment technology