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

# `h3_try_validate` 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 11.3 LTS and above ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Lakehouse//RT

Returns the input value, that is of type BIGINT or STRING, if it corresponds to a valid H3 cell, or NULL otherwise. In the case of STRING input, any leading zeros are trimmed.

## Syntax

```
h3_try_validate ( h3CellIdExpr )
```

## Arguments

* `h3CellIdExpr`: A BIGINT expression, or a STRING expression that is expected to represent a valid H3 cell ID.

## Returns

A value of the same type as the type of the `h3CellIdExpr` expression, and equal to the value of the input `h3CellIdExpr` expression, or NULL. In the case of STRING input, any leading zeros are trimmed.

The function returns NULL if the input is NULL.
The function can return NULL for non-NULL inputs.

## Examples

```sql
-- Simple example taking a long as input.
> SELECT h3_try_validate(590112357393367039);
  590112357393367039

-- Simple example taking a hexadecimal string as input.
> SELECT h3_try_validate('85283473fffffff');
  85283473fffffff

-- Simple taking a long as input, that is not a valid H3 cell ID.
> SELECT h3_try_validate(599686042433355776);
  null
```

## Related functions

* [`h3_isvalid` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_isvalid.md)
* [`h3_validate` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_validate.md)
