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

# `h3_isvalid` 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 true if the input BIGINT or STRING is a valid H3 cell ID.

## Syntax

```
h3_isvalid ( expr )
```

## Arguments

* `expr`: A BIGINT expression, or a STRING expression.

## Returns

A value of type BOOLEAN, indicating whether the input BIGINT or STRING corresponds to a valid H3 cell ID or not.

The function returns NULL if the input is NULL.

## Examples

```sql
-- Simple example taking a long as input.
> SELECT h3_isvalid(599686042433355775);
  true

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

-- Example taking a long as input that is not a valid H3 cell ID.
> SELECT h3_isvalid(599686042433355776);
  false

-- Example where the input is an invalid hexadecimal string.
> SELECT h3_isvalid('I am not an H3 cell ID');
  false
```

## Related functions

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