I am generating XML in Oracle PL/SQL with the DBMS_XMLGEN package:

OPEN base_cursor FOR SELECT * FROM foo;
base_context := dbms_xmlgen.newcontext(base_cursor);
base_xml := dbms_xmlgen.getxmltype(base_context, dbms_xmlgen.none);

My problem is that whatever I do I always get the tag names in upper case. To maintain compatibility with things further downstream, I need them to be in lower case. Is there any way I can fix this?

I know there is an option for this in DBMS_XMLQUERY, but the docs says it is not recommended to use that package.

  • Doc says whenever possible use DBMS _XMLGEN. If not you can use the DBMS_XMLQUERY as well.
    – atokpas
    Commented Sep 24, 2016 at 1:28

1 Answer 1


According to ORACLE-BASE,

Where possible DBMS_XMLGEN should be used as it is more efficient than using the Java based DBMS_XMLQUERY


The example below is a copy of the previous code with all references to DBMS_XMLQUERY replaced by references to DBMS_XMLGEN. Note that two of the lines have been commented out as this functionality is currently not present in DBMS_XMLGEN

I added my emphasis, because this refers specifically to the settagcase you are looking for.

--DBMS_XMLGEN.settagcase(v_ctx, DBMS_XMLGen.LOWER_CASE);

So it looks like you are stuck with the slower DBMS_XMLQUERY.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.