---
title: h3_validate function
description: Learn the syntax of the h3\_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_validate
---

# `h3_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 ID, or emits an error otherwise. In the case of STRING input, any leading zeros are trimmed.

## Syntax

```
h3_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. In the case of STRING input, any leading zeros are trimmed.

The function returns NULL if the input is NULL.

## Error conditions

* If `h3CellIdExpr` is not a valid H3 cell ID, the function returns [H3\_INVALID\_CELL\_ID](https://docs.databricks.com/aws/en/error-messages/h3-invalid-cell-id-error-class.md).

## Examples

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

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

-- Example taking a long as input that is not a valid H3 cell ID.
> SELECT h3_validate(599686042433355776);
  [H3_INVALID_CELL_ID] 599686042433355776 is not a valid H3 cell ID

-- Example where the input is an invalid hexadecimal string.
> SELECT h3_validate('I am not an H3 cell id');
  [H3_INVALID_CELL_ID] 'I am not an H3 cell id' is not a valid H3 cell ID
```

## Related functions

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