---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://ydb.tech/docs/en/yql/reference/syntax/declare.md?version=v25.3
  - https://ydb.tech/docs/ru/yql/reference/syntax/declare.md?version=v25.3
  - href: en/yql/reference/syntax/declare.md
    type: text/markdown
    title: Markdown version
  - href: ../../../llms.txt
    type: text/markdown
    title: llms.txt
sourcePath: en/core/yql/reference/syntax/declare.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# DECLARE

Declares a typed [named expression](https://ydb.tech/docs/en/yql/reference/syntax/expressions.md?version=v25.3#named-nodes) whose value will be passed separately from the query text. With parameterization, you can separately develop an analytical solution and then launch it sequentially with different input values.

In the case of transactional load, parameters let you avoid recompilation of queries when repeating calls of the same type. This way you can reduce server utilization and exclude compilation time from the total time of query execution.

Passing of parameters is supported in the SDK, CLI, and graphical interfaces.

## Syntax

```yql
DECLARE $named-node AS data_type;
```

1. `DECLARE` keyword.
1. `$named-node`: The name by which you can access the passed value. It must start with `$`.
1. `AS` keyword.
1. `data_type` is the data type [represented as a string in the accepted format](https://ydb.tech/docs/en/yql/reference/types/type_string.md?version=v25.3).

Only serializable data types are allowed:

* [Primitive types](https://ydb.tech/docs/en/yql/reference/types/primitive.md?version=v25.3).
* [Optional types](https://ydb.tech/docs/en/yql/reference/types/optional.md?version=v25.3).
* [Containers](https://ydb.tech/docs/en/yql/reference/types/containers.md?version=v25.3), except `Stream<Type>`.
* `Void` and `Null` are the supported [special types](https://ydb.tech/docs/en/yql/reference/types/special.md?version=v25.3).

## Example

```yql
DECLARE $x AS String;
DECLARE $y AS String?;
DECLARE $z AS List<String>;

SELECT $x, $y, $z;
```

