当前位置:网站首页>[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 ; $$
边栏推荐
- Global and Chinese markets of cast iron diaphragm valves 2022-2028: Research Report on technology, participants, trends, market size and share
- 【c】 Digital bomb
- Global and Chinese market of micro positioning technology 2022-2028: Research Report on technology, participants, trends, market size and share
- JMeter connection database
- 10 smart contract developer tools that miss and lose
- 2022-06-28 advanced network engineering (XIII) IS-IS route filtering, route summary, authentication, factors affecting the establishment of Isis neighbor relations, other commands and characteristics
- Bool blind note - score query
- Use of aggregate functions
- AcWing 1460. Where am i?
- Assign the CMD command execution result to a variable
猜你喜欢

IP address is such an important knowledge that it's useless to listen to a younger student?
![Oak-d raspberry pie cloud project [with detailed code]](/img/34/76b461bf03fba373da5b5898c5204c.jpg)
Oak-d raspberry pie cloud project [with detailed code]

HCIA-USG Security Policy

AcWing 1460. Where am i?

Exercises of function recursion

CMD implements the language conversion of locale non Unicode programs

BOC protected tryptophan porphyrin compound (TAPP Trp BOC) Pink Solid 162.8mg supply - Qiyue supply

BOC protected alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC supplied by Qiyu

IPv6 experiment
![How to read the source code [debug and observe the source code]](/img/0d/6495c5da40ed1282803b25746a3f29.jpg)
How to read the source code [debug and observe the source code]
随机推荐
Xctf attack and defense world crypto master advanced area olddriver
NFT without IPFs and completely on the chain?
How can the outside world get values when using nodejs to link MySQL
Pat grade B 1009 is ironic (20 points)
Based on laravel 5.5\5.6\5 X solution to the failure of installing laravel ide helper
Global and Chinese market of rubidium standard 2022-2028: Research Report on technology, participants, trends, market size and share
MPLS configuration
Rad+xray vulnerability scanning tool
Global and Chinese market of micro positioning technology 2022-2028: Research Report on technology, participants, trends, market size and share
unittest框架基本使用
FPGA learning notes: vivado 2019.1 project creation
47. Process lock & process pool & Collaboration
Upgrade PIP and install Libraries
2.4 conversion of different data types
44. Concurrent programming theory
Nerfplusplus parameter format sorting
HCIA-USG Security Policy
Point cloud data denoising
Vscode reports an error according to the go plug-in go get connectex: a connection attempt failed because the connected party did not pro
4. Data binding