�瓐SQL�誩��䜘��b>�䬐ML�株”蝷箝��/b>�栶�喋��胯��踺��刻”蝷箝���XML�桃��僐雿輻鍂���整��
declare
l_XML varchar2(32767);
begin
-- force Oracle APEX to not show any HTML
sys.htp.init;
wwv_flow.g_page_text_generated := true;
wwv_flow.g_unrecoverable_error := true;
-- select XML
select xmlElement
(
"Department",
xmlAttributes( d.DEPTNO as "DepartmentNumber"),
xmlElement("Name", d.DNAME),
xmlElement("Location", d.LOC),
xmlElement
(
"EmployeeList",
(
select xmlAgg
(
xmlElement
(
"Employee",
xmlAttributes ( e.EMPNO as "employeeNumber" ),
xmlForest
(
e.ENAME as "EmpolyeeName", e.JOB as "JobTitle", e.SAL as "EmployeeSalary"
),
xmlElement ( "Commission", e.COMM )
)
)
from WWV_DEMO_EMP e
where e.DEPTNO = d.DEPTNO
)
)
).getClobVal()
into l_XML
from WWV_DEMO_DEPT d
where d.DEPTNO = 20;
-- Display HTML document
sys.owa_util.mime_header('text/xml',FALSE);
sys.htp.p('Content-Length: ' || length(l_XML));
sys.owa_util.http_header_close;
sys.htp.print(l_XML);
end;