我在 Oracle 中使用 json_arrayagg 從表中的多行創建一個 json 陣列。以下是詳細資訊:
create table classInfo (classId integer, category CLOB);
insert into classInfo(1, '{"category":"AAA"}');
insert into classInfo(2, '{"category":"BBB"}');
commit;
select json_arrayagg(category returning clob) from classInfo;
輸出有一個 \ 和 ",如下所示:
["{\"category\""AAA\"}", "{\"category\":\"BBB\"}"]
我怎樣才能擺脫那些 \ ?
提前致謝!
uj5u.com熱心網友回復:
使用FORMAT JSON:
select json_arrayagg(category FORMAT JSON RETURNING CLOB) from classInfo;
哪個輸出:
JSON_ARRAYAGG(CATEGORYFORMATJSONRETURNINGCLOB) [{“類別”:“AAA”},{“類別”:“BBB”}]
db<>在這里擺弄
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/494501.html
標籤:甲骨文 json-arrayagg
下一篇:即使列存在也獲取無效識別符號
