How to write large XML doc from XMLTYPE to an OS file

(Doc ID 1567036.1)

Last updated on NOVEMBER 20, 2013

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Information in this document applies to any platform.

Goal

I have a requirement to export large xml files (couple of MB each file in a single write/put) from an XMLTYPE into an OS file.  I have tried the following but each one listed below has its own limitation on the number of characters per single write operation.

  1. UTL_FILE.PUT_RAW/PUT - Supports only less than 32676 characters.
  2. DBMS_XSLPROCESSOR.CLOB2FILE supports more than 32676 characters however the written file is chopped off around 50K.

How to get around the 50K limitation?

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms