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

# DECLARE

## Synopsis

```text theme={null}
DECLARE identifier [, ...] type [ DEFAULT expression ]
```

## Description

Use the `DECLARE` statement directly after the [begin](/sql/routines/begin) keyword in
[routines](/sql/routines/introduction) to define one or more variables with an `identifier` as name.

{/* Each statement must specify the [data type](/sql/reference/types) of the variable with
`type`. It can optionally include a default, initial value defined by an
`expression`. The default value is `NULL` if not specified. */}

## Examples

A simple declaration of the variable `x` with the `tinyint` data type and the
implicit default value of `null`:

```sql theme={null}
DECLARE x tinyint;
```

A declaration of multiple string variables with length restricted to 25
characters:

```sql theme={null}
DECLARE first_name, last_name, middle_name varchar(25);
```

A declaration of an exact decimal number with a default value:

```sql theme={null}
DECLARE uptime_requirement decimal DEFAULT 99.999;
```

A declaration with a default value from an expression:

```sql theme={null}
DECLARE start_time timestamp(3) with time zone DEFAULT now();
```

Further examples of varying complexity that cover usage of the `DECLARE`
statement in combination with other statements are available in the [SQL
routines examples documentation](/sql/routines/examples).

## See also

* [routines](/sql/routines/introduction)

{/* * [](/sql/reference/types) */}
