Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 如何使用字符串到数组中的数组值连接到查找表_Postgresql - Fatal编程技术网

Postgresql 如何使用字符串到数组中的数组值连接到查找表

Postgresql 如何使用字符串到数组中的数组值连接到查找表,postgresql,Postgresql,我有一张这样的动物桌: Column | Type | Collation | Nullable | Default ------------------+--------------------------+-----------+----------+--------- animal_code | character varying(3) | | not null | animal_t

我有一张这样的动物桌:

      Column      |           Type           | Collation | Nullable | Default 
------------------+--------------------------+-----------+----------+---------
 animal_code      | character varying(3)     |           | not null | 
 animal_type_code | character(2)             |           | not null | 
 description      | character varying(64)    |           | not null | 
典型的内容可能是:

 animal_code | animal_type_code |      description
-------------+------------------+------------------------------
 XAA         | T                | Not an animal, but a toaster
 1           | D                | This is a dog called Bob
 2           | C                | This cat is called Frank
 3           | C                | Wilf the cat has three legs
 4           | D                | Thunder is a dog
我正在使用的一个现有存储过程接收一个文本字符串,其中包含一个逗号分隔的动物代码值列表,如下所示:

      Column      |           Type           | Collation | Nullable | Default 
------------------+--------------------------+-----------+----------+---------
 animal_code      | character varying(3)     |           | not null | 
 animal_type_code | character(2)             |           | not null | 
 description      | character varying(64)    |           | not null | 
商店宠物展示详情 “伦敦”,p_场馆VARCHAR64 “2019-12-03”,p_日期 “XAA,91,22,23,74,15,64,47,12”-p_参赛者文本 ; 我正在使用unneststring_to_arraycode_csv,,'来提取动物输入代码

这可能很简单,但我只是想看看是否有参赛者的动物类型代码为T

请注意这一点

选择动物代码、动物类型代码、描述 来自动物 内部连接选择从unneststring_到arrayp_entrants的trime entrant,,'t 关于动物_代码=进入者 其中,动物类型代码='T';