Back to top
  Back to overview

LET statement

The LET statement sets and stores a value which can then be used in a subsequent query. A parameter can store any value, including the result of a query.

Statement syntax

LET $@parameter = @value;

Example usage

The following query shows example usage of this statement.

-- Define the parameter
LET $name = "tobie";
-- Use the parameter
CREATE person SET name = $name;

The following query shows the LET statement being used to store the result of a subquery.

-- Define the parameter
LET $adults = (SELECT * FROM person WHERE age > 18);
-- Use the parameter
UPDATE $adults SET adult = true;