当前位置:网站首页>[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 ; $$
边栏推荐
- AI enhanced safety monitoring project [with detailed code]
- Commands related to files and directories
- Assign the CMD command execution result to a variable
- Exercises of function recursion
- Network security Kali penetration learning how to get started with web penetration how to scan based on nmap
- Day6 merge two ordered arrays
- Micro service knowledge sorting - cache technology
- Fingerprint password lock based on Hal Library
- Upgrade PIP and install Libraries
- 11-grom-v2-04-advanced query
猜你喜欢

How can the outside world get values when using nodejs to link MySQL

Machine learning support vector machine SVM
![Meso tetra [P - (p-n-carbazole benzylidene imino)] phenylporphyrin (tcipp) /eu (tcipp) [pc( α- 2-oc8h17) 4] and euh (tcipp) [pc (a-2-oc8h17) 4] supplied by Qiyue](/img/5b/fc776a1982e24b82984d82be6a016f.jpg)
Meso tetra [P - (p-n-carbazole benzylidene imino)] phenylporphyrin (tcipp) /eu (tcipp) [pc( α- 2-oc8h17) 4] and euh (tcipp) [pc (a-2-oc8h17) 4] supplied by Qiyue

2022 Xinjiang latest construction eight members (standard members) simulated examination questions and answers

Promethus

Exercises of function recursion
![[effective Objective-C] - block and grand central distribution](/img/09/22b979b97ea13d649b4b904637b79f.jpg)
[effective Objective-C] - block and grand central distribution

FAQs for datawhale learning!

Based on laravel 5.5\5.6\5 X solution to the failure of installing laravel ide helper

2022 Xinjiang latest road transportation safety officer simulation examination questions and answers
随机推荐
Acquisition and transmission of parameters in automatic testing of JMeter interface
2. Template syntax
Global and Chinese markets of cast iron diaphragm valves 2022-2028: Research Report on technology, participants, trends, market size and share
Microservice knowledge sorting - search technology and automatic deployment technology
[raid] [simple DP] mine excavation
BOC protected tryptophan porphyrin compound (TAPP Trp BOC) Pink Solid 162.8mg supply - Qiyue supply
Geek Daily: the system of monitoring employees' turnover intention has been deeply convinced off the shelves; The meta universe app of wechat and QQ was actively removed from the shelves; IntelliJ pla
2022 Xinjiang latest construction eight members (standard members) simulated examination questions and answers
AcWing 1460. Where am i?
Xctf attack and defense world crypto master advanced area olddriver
Microservice framework - frequently asked questions
Initialization and instantiation
Global and Chinese market of electrolyte analyzers 2022-2028: Research Report on technology, participants, trends, market size and share
2022 - 06 - 30 networker Advanced (XIV) Routing Policy Matching Tool [ACL, IP prefix list] and policy tool [Filter Policy]
【leetcode】1027. Longest arithmetic sequence (dynamic programming)
【c】 Digital bomb
Sparse matrix (triple) creation, transpose, traversal, addition, subtraction, multiplication. C implementation
Detailed and not wordy. Share the win10 tutorial of computer reinstallation system
Make a simple text logo with DW
unittest框架基本使用