Share via


Funzione to_xml

Si applica a:check marked yes Databricks SQL check marked yes Databricks Runtime

Restituisce una stringa XML con lo struct specificato in expr.

Sintassi

to_xml(expr [, options] )

Argomenti

  • expr: espressione STRUCT.
  • options: espressione letterale MAP facoltativa con chiavi e valori stringa.

Valori restituiti

STRINGA.

Per informazioni dettagliate sul possibile, vedere from_xml funzione .options

Esempi

> 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>