我有一个以XML格式给出结果的查询。现在我想将此结果保存为XML文件,以便我可以将其用于其他目的。
SELECT XMLElement("DEPARTMENT"
, XMLForest(department_id as "ID"
, department_name as "NAME"
)
)
FROM departments
WHERE department_id IN (10, 20);
我将如何在oracle(PL / SQL)中执行此操作 我刚刚读到了UTL_FILE,但老实说,一个例子可以帮助我在Linux和Windows上。
答案 0 :(得分:0)
请参阅评论中的链接。您也可以尝试SYS_XMLGEN:
SELECT SYS_XMLGEN(XMLElement("DEPARTMENT"
, XMLForest(deptno as "ID"
, dname as "NAME"
)
)
) xml_output
FROM scott.dept
WHERE deptno IN (10, 20)
/