i have created 1 XML node using oracle. i need the output some different way, means one of the node i don't want to close as node name only</> code is like below.
CREATE or replace FUNCTION GetEmpName
(
NAME VARCHAR
)
RETURN varchar2
IS RtKeys varchar2(2000);
BEGIN
SELECT XMLElement("TableKeys",
XMLAGG(XMLElement("rt", XMLAttributes(e.ENAME||' 'AS ENAME,e.EMPNO AS EmNo),
XMLElement("rb", XMLAttributes(e.HIREDATE||' 'AS HIREDATE,e.JOB||' 'AS JOB))))
).getStringVal()
INTO RtKeys
FROM emp e inner join EMPDep ed
on e.DEPTNO = ed.DEPTNO where e.ename = NAME order by e.JOB;
RETURN RtKeys;
END;
output i am getting as:
<TableKeys><rt ENAME="ADAMS " EMNO="7876"><rb HIREDATE="12-JAN-83 " JOB="CLERK
"></rb></rt></TableKeys>
but i need the output as below:
<tablekeys>
my expected output: <rb ........></> only need to use </>
please look into the code and tell me how to do.
What I have tried:
i have tried as passing.
XMLElement("rb", XMLAttributes(e.HIREDATE||' 'AS HIREDATE,e.JOB||' 'AS "JOB"
but not working.