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

> Reference material for ARRAY_ENUMERATE function

# ARRAY_ENUMERATE

This function takes an array of arbitrary type as input, and produces an integer array of the same length containing increasing numbers.
The returned array starts with value one. Every successive element is incremented by one, it holds that `array[i] = array[i - 1] + 1`.

`NULLs` contained in the parameter array are treated like any other value, and result in a non-null element in the returned array.

If the parameter array is `NULL`, then the function also returns `NULL`.

## Syntax

```sql theme={"theme":{"light":"css-variables","dark":"css-variables"}}
ARRAY_ENUMERATE(<array>)
```

## Parameters

| Parameter | Description                                                                                                    | Supported input types |
| :-------- | :------------------------------------------------------------------------------------------------------------- | :-------------------- |
| `<array>` | The array to be enumerated. The length of the returned array is the same as the length of the parameter array. | Any array type.       |

## Return Type

`ARRAY(INT)`

## Example

The following example returns an array with values one to four:

<div className="query-window">
  ```
  SELECT ARRAY_ENUMERATE([7, 9, 3, 4]) AS one_to_four;
  ```

  | one\_to\_four <span>array(int)</span> |
  | :------------------------------------ |
  | \[1, 2, 3, 4]                         |

  <p><span>Rows: 1</span><span>Execution time: 6.81ms</span></p>
</div>

The array passed to the function can contain arbitrary types:

<div className="query-window">
  ```
  SELECT ARRAY_ENUMERATE(['hello', 'world']) AS one_to_two;
  ```

  | one\_to\_two <span>array(int)</span> |
  | :----------------------------------- |
  | \[1, 2]                              |

  <p><span>Rows: 1</span><span>Execution time: 5.84ms</span></p>
</div>

NULL values are still reflected in the returned result:

<div className="query-window">
  ```
  SELECT ARRAY_ENUMERATE([7, NULL, 3, NULL]) AS one_to_four;
  ```

  | one\_to\_four <span>array(int)</span> |
  | :------------------------------------ |
  | \[1, 2, 3, 4]                         |

  <p><span>Rows: 1</span><span>Execution time: 5.10ms</span></p>
</div>

If the array passed to the function is NULL, so is the result:

<div className="query-window">
  ```
  SELECT ARRAY_ENUMERATE(NULL) AS null_result;
  ```

  | null\_result <span>array(int) null</span> |
  | :---------------------------------------- |
  | NULL                                      |

  <p><span>Rows: 1</span><span>Execution time: 5.51ms</span></p>
</div>
