![](/img/trans.png)
[英]Output json from sqlplus. Format it so that it appears on one line
[英]SQLPlus results in one line
我有一個用戶表,正在其中查找名稱為john的用戶ID。
select USER_ID from user where USER_ID like '%john%';
我懂了
USER_ID
-------
john1
john2
john3
有沒有一種方法可以將我的信息從SQLPlus顯示回單行? 喜歡
john1, john2, john3
假設您使用的是11.2( oracle11g
標記也可能表示11.1)
select listagg( user_id, ',' ) within group (order by user_id )
from user
where user_id like '%john%';
有關Oracle不同版本中可用的各種字符串聚合技術的規范列表,我建議Tim Hall撰寫有關字符串聚合技術的文章。
在Oracle 11g中檢查數據透視查詢。 http://www.oracle-developer.net/display.php?id=506
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.