Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime
Returns an XML string with the struct or variant specified in expr.
Syntax
to_xml(expr [, options] )
Arguments
expr: A STRUCT or VARIANT expression.options: An optional MAP literal expression with keys and values being STRING.
Returns
A STRING.
For a complete list of options, see XML.
Examples
> SELECT to_xml(named_struct('a', 1, 'b', 2));
<ROW><a>1</a><b>2</b></ROW>
> SELECT to_xml(named_struct('time', to_timestamp('2015-08-26', 'yyyy-MM-dd')), map('timestampFormat', 'dd/MM/yyyy'));
<ROW><time>26/08/2015</time></ROW>
> SELECT to_xml(from_xml('<a>1</a><b>2</b>', 'variant'));
<ROW><a>1</a><b>2</b></ROW>