DECLARE

    Declares a typed named expression 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

    DECLARE $named-node AS data_type;
    
    1. DECLARE keyword.
    2. $named-node: The name by which you can access the passed value. It must start with $.
    3. AS keyword.
    4. data_type is the data type represented as a string in the accepted format.

    Only serializable data types are allowed:

    Example

    DECLARE $x AS String;
    DECLARE $y AS String?;
    DECLARE $z AS List<String>;
    
    SELECT $x, $y, $z;