Skip to content

How can a custom outbound XML file generated via `Xml_Record_Writer_SYS` from PL/SQL include a proper `<?xml version="1.0" encoding="UTF-8"?>` declaration as its very first line, since there's no direct parameter for it on the package's element-writing calls?

Answer

Build the XML into a CLOB using a temporary LOB, write the XML declaration string directly into that CLOB first (for example, via a document-start writer call followed by appending the literal prolog text), and only then continue building the rest of the document using Xml_Record_Writer_SYS as normal — the declaration line needs to be written directly into the output stream ahead of the record-writer's own element calls rather than being something the record-writer package generates for you automatically.

← Browse Integrations and APIs questions