Purpose
Reads an XML document from memory as VARCHAR, writes it to an external server file, and returns the file name and path as an XMLFILE type.
Syntax
XMLFileFromVarchar |
---|
>>-XMLFileFromVarchar--(--buffer--,--fileName--)--------------->< |
Parameters
Table 24. XMLFileFromVarchar parameters
Parameter | Data type | Description |
---|---|---|
buffer | VARCHAR(3K) | The memory buffer. |
fileName | VARCHAR(512) | The fully qualified server file name. |
Return type
XMLFILE
Example
The following examples reads an XML document from memory as VARCHAR, writes it to an external server file, and and inserts the file name and path as an XMLFILE type in an XML column.
EXEC SQL BEGIN DECLARE SECTION; struct { short len; char data[3000]; } xml_buff; EXEC SQL END DECLARE SECTION; EXEC SQL INSERT INTO sales_tab(ID, NAME, ORDER) VALUES('1234', 'Sriram Srinivasan', XMLFileFromVarchar(:xml_buf, 'c:\dxx\samples\cmd\getstart.xml'))
The column ORDER in the SALES_TAB table is defined as an XMLFILE type. The preceding example shows that if you have an XML document in your buffer, you can store it in a server file.