---
title: xpath_number function
description: Learn the syntax of the xpath\_number function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_number
---

# `xpath_number` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns a `DOUBLE` value from an XML document.

## Syntax

```
xpath_number(xml, xpath)
```

## Arguments

* `xml`: A `STRING` expression of XML.
* `xpath`: A `STRING` expression that is a well formed XPath.

## Returns

A `DOUBLE`.

The result is zero if no match is found, or `NaN` if a match is found but the value is non-numeric.

The function raises an error if `xml` or `xpath` are malformed.

## Examples

```sql
> SELECT xpath_number('<a><b>1</b><b>2</b></a>', 'sum(a/b)');
 3.0
```

## Related functions

* [`xpath` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath.md)
* [`xpath_boolean` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_boolean.md)
* [`xpath_float` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_float.md)
* [`xpath_int` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_int.md)
* [`xpath_long` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_long.md)
* [`xpath_double` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_double.md)
* [`xpath_short` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_short.md)
* [`xpath_string` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_string.md)
