XMLType

Description

This Oracle-supplied type can be used to store and query XML data in the database. XMLType has member functions you can use to access, extract, and query the XML data using XPath expressions. (Oracle SQL Language Reference XML Data Type)

Snowflake handles semi-structured data types (including XMLTYPE) using the VARIANT data type, for this reason, XMLTYPEs are to be migrated to VARIANT, and then usages of functions used to manipulate and query XML must be migrated to Snowflake's counterparts. For more information on how to use XML in Snowflake, please refer to this post in the Snowflake forum and the TO_XML function documentation in Snowflake.

XMLTYPE

Sample Source Patterns

XMLType in Create Table

Oracle

CREATE TABLE xml_table(
    xml_column XMLTYPE,
);

Snowflake

CREATE OR REPLACE TABLE PUBLIC.xml_table (
-- ** MSC-ERROR - MSCEWI1028 - TYPE NOT SUPPORTED **
--xml_column XMLTYPE
                  ,
-- ** MSC-ERROR - MSCEWI1028 - TYPE NOT SUPPORTED **
--xml_column2 SYS.XMLTYPE
                       );

Insert data in the XML column

Oracle

INSERT INTO xml_table VALUES(
    XMLType(
'<?xml version="1.0"?>  
<note>  
  <to>SnowConvert</to>  
  <from>Oracle</from>  
  <heading>Greeting</heading>  
  <body>Hello there!</body>  
</note>')
);

Snowflake

INSERT INTO PUBLIC.xml_table(xml_column) VALUES(/*** MSC-ERROR - MSCEWI3016 - FUNCTION RELATED WITH XML NOT SUPPORTED ***/
PUBLIC.XMLTYPE_UDF('XMLType(\'<?xml version="1.0"?>  <note>    <to>SnowConvert</to>    <from>Oracle</from>    <heading>Greeting</heading>    <body>Hello there!</body>  </note>\')')
);

Known Issues

1. XMLType manipulation and query functions are not recognized

The functions for manipulating and querying XML such as XMLTYPE() are not being recognized nor transformed by SnowConvert.

  1. MSCEWI1028: Type is not supported.

  2. MSCEWI1049: Not recognized function.

  3. MSCEWI3016: XML is not supported.

Last updated