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

# `typeof` 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

Return a DDL-formatted type string for the data type of the input.

## Syntax

```
typeof(expr)
```

## Arguments

* `expr`: Any expression.

## Returns

A `STRING`.

To derive the type of a `VARIANT` value, use the [`schema_of_variant` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/schema_of_variant.md) function.

To derive the combined schema of a group of `VARIANT` values, use the [`schema_of_variant_agg` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/schema_of_variant_agg.md) aggregate function.

## Examples

```sql
> SELECT typeof(1);
 int

> SELECT typeof(array(1));
 array<int>

> SELECT typeof(123.4::VARIANT);
 variant

> SELECT schema_of_variant(123.4::VARIANT);
 DECIMAL(4,1)

> SELECT typeof('hello' COLLATE UTF8_LCASE);
 string collate UTF8_LCASE
```

## Related functions

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