【发布时间】:2020-02-27 14:24:26
【问题描述】:
我正在尝试在 sql 中连接一些字符串。我想做的是类似
string organType = null;
if (liver!=null) { organType += "LI, "; }
if (kidney !=null) { organType += "KI, "; }
if (intestine != null) { organType += "Intestine"; }
...
最终结果应该是organType = LI, KI, Intestine;
这是我目前的代码
创建或替换 PROCEDURE "insertDonInfo"(donNum IN NUMBER, offerDate IN DATE)
是
organType varchar2(100);
BEGIN
select case when liver is not null then 'LI'
when kidney_r is not null then 'KR'
when kidney_l is not null then 'KL'
when heart is not null then 'HE'
when liver_domino is not null then 'LI-Dom'
when lung_r is not null then 'LungR'
when pancreas is not null then 'PA'
when liver_split is not null then 'Lsplit'
when lung_l is not null then 'LungL'
when intestine is not null then 'Intestine'
end
from donors
where id = donNum;
...
--------------更新----------
如何在 SQL 中将organType 连接为organType=LI, KR, KL, HE, ...;
【问题讨论】:
-
你的问题是什么?