Can't use a varchar2 variable in XMLElement?

mcothmane

New Member
I need to do some processing on some data from an Oracle database and then print it as XML. I'm using XMLElement and the methods that go with it. However, I've found that if I pass a varchar into a PL/SQL function and then pass that variable to XMLElement, it prints the variable name instead of its content, like so:\[code\]create or replace function gen_elem(label1 varchar2, value1 varchar2) return XMLTypeis result_xml XMLType;begin select XMLElement(label1,value1) into result_xml from dual; return result_xml;end;> select gen_elem_tmp('myname','myvalue') from dual;GEN_ELEM_TMP('MYNAME','MYVALUE')------------------------------------------------<LABEL1>myvalue</LABEL1>\[/code\]I'm guessing this is XMLElement 'helpfully' interpreting my variable name as a database column. Is there any way of getting it to use my variable's contents, instead?
 
Back
Top