> ## 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.

# SEQ4

> Produces a sequence of BIGINT values for each query, wrapping at the 32-bit boundary according to the sign option.

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

The valid niladic/literal-sign form produces non-NULL values; NULL sign arguments are rejected.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
seq4([sign])
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| sign | INTEGER literal | No | 0 selects unsigned wrapping; 1 selects signed wrapping. Only literal 0 or 1. Must be a constant argument. Default: 0. |

## Returns

* Type: BIGINT
* Possible values: Sign 0 wraps through 0..4294967295; sign 1 wraps into -2147483648..2147483647.
* NULL behavior: The valid no-argument/literal-sign form produces non-NULL values; NULL sign arguments are rejected.

## Properties

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

## Usage notes

* Each sequence column has its own counter, starting at 0 for each new query.
* Which number is assigned to each row can vary with execution order. Use ORDER BY to sort the output.
* Deterministic: The sequence assigned to each row can change with execution order.

## Examples

### Typical behavior

* A fresh query/sequence operator; sorted output.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT seq4() AS "value" FROM TABLE(GENERATOR(ROWCOUNT => 3)) ORDER BY "value";
```

| value |
| - |
| 0 |
| 1 |
| 2 |

## Limitations

* Sequence values are not a persistent database sequence and are not guaranteed gap-free after upstream/downstream filtering or LIMIT.

## Related functions

* [generator](/query/sql/functions/table/generator)


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