OCI sample code to Write/Read Large XML Document into Xmltype Column
(Doc ID 1296105.1)
Last updated on JUNE 27, 2023
Applies to:
Oracle Database - Enterprise Edition - Version 10.2.0.5 and laterGen 1 Exadata Cloud at Customer (Oracle Exadata Database Cloud Machine) - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Oracle Database Cloud Schema Service - Version N/A and later
Information in this document applies to any platform.
Goal
Provides Sample Code on how to insert a Large XML document into an XMLType column/table using OCI.
Note:
When XML document is > 4k, inserting a XML as a text string using OCI fails with ORA-1461.
To overcome the 4k limitation the CLOB should be built using the OCI API below.
- OCILobLocator
- OCIDescriptorAlloc
- OCILobCreateTemporary
- OCILobWrite
and then insert the CLOB into XMLTYPE column/table.
This example expands on the sample program
$ORACLE_HOME/rdbms/demo/cdemoxml.c by adding code to load the LOB from a file of
variable length.
Note also that XML files can be inserted via a combination of the XDK for C and OCI -
an example is included in
Section A of the Appendixes to the XML DB Developer Guide under:
Loading XML Data using C (OCI)
Solution
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Goal |
Solution |
Requirements |
Configuring |
Instructions |
Sample Code |
Sample Output |
References |