XML data type support in external routines
The programming languages C, C++, COBOL, and Java support parameters and variables of data type XML.
External Java routines which use PARAMETER STYLE HIVE do not support parameters of data type XML.
XML data type values are represented in external routine code in the same way as CLOB data types.
When declaring external routine parameters of data type XML, the CREATE PROCEDURE and CREATE FUNCTION statements that will be used to create the routines in the database must specify that the XML data type is to be stored as a CLOB data type. The size of the CLOB value should be close to the size of the XML document represented by the XML parameter.
CREATE PROCEDURE myproc(IN parm1 XML AS CLOB(2M), IN parm2 VARCHAR(32000)) LANGUAGE C FENCED PARAMETER STYLE SQL EXTERNAL NAME 'mylib!myproc';
CREATE FUNCTION myfunc (IN parm1 XML AS CLOB(2M)) RETURNS SMALLINT LANGUAGE C PARAMETER STYLE SQL DETERMINISTIC NOT FENCED NULL CALL NO SQL NO EXTERNAL ACTION EXTERNAL NAME 'mylib1!myfunc'
XML data is materialized when passed to stored procedures as IN, OUT, or INOUT parameters. If you are using Java™ stored procedures, the heap size (java_heap_sz configuration parameter) might need to be increased based on the quantity and size of XML arguments, and the number of external stored procedures that are being executed concurrently.
Within external routine code, XML parameter and variable values are accessed, set, and modified in the same way as in database applications.