我试图在表格中添加单行
我的查询设计如下
select
upper(listagg(table_nm,',') within group (order by table_nm)) as table_nm
from
db.tb
where
subject_area='TLS'
并输出
TLS_TASK,TLS_USER
但我希望输出为
'TLS_TASK','TLS_USER'
请帮我这个
答案 0 :(得分:3)
您需要再提供3个引号来附上报价。引号内的''
代表单引号。
SELECT Upper(Listagg(''''
||table_nm
||'''', ',')
within GROUP (ORDER BY table_nm)) AS table_nm
FROM db.tb
WHERE subject_area = 'TLS';
答案 1 :(得分:1)
在'
table_nm
select
upper(listagg(''''||table_nm||'''',',') within group (order by table_nm)) as table_nm
from
db.tb
where
subject_area='TLS'