> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TYPEOF

> Returns the SQL type name of an expression.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

A typed NULL reports its declared type. An untyped NULL reports void.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
typeof(value)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT | Yes | Expression whose declared type is inspected. DECIMAL values currently raise an execution error. |

## Returns

* Type: STRING
* Possible values: A lowercased SQL/DDL-style type description.
* NULL behavior: A typed NULL reports its declared type. An untyped NULL reports void.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* The result depends on the declared argument type, not its row value. Nested arrays/maps/structs are rendered recursively.
* VARIANT storage is recognized before ordinary structs.
* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.
* Deterministic: The same inputs and settings produce the same result.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT typeof(CAST(1 AS BIGINT)) AS "value", typeof(CAST(NULL AS BIGINT)) AS typed_null;
```

| value | typed\_null |
| - | - |
| bigint | bigint |

### Inspect concrete input types

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT typeof(CAST(7 AS BIGINT)) AS integer_type, typeof(ARRAY('red', 'blue')) AS array_type;
```

| integer\_type | array\_type |
| - | - |
| bigint | array\<string> |

## Limitations

* DECIMAL types currently raise an error. This also applies to DECIMAL values nested inside ARRAY, MAP, or STRUCT.
* Some less common types return descriptive names that cannot be used directly in a SQL type declaration.
* DECIMAL input currently raises an execution error; cast it to an explicitly chosen nondecimal type before calling TYPEOF.

## Related functions

* [cast](/query/sql/functions/conditional/cast)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.