Modify and optimize SQL code with the flexibility of variables
Variables and constants store values you can later use anywhere in your query.
Variables are placeholders that can be assigned and reassigned values throughout the SQL code.
To assign a value to a variable, use the equal sign =
followed by the value.
For example, take a look at the following Latitude Query, and what will actually be compiled and executed in the database:
Variables can be modified using operations such as addition.
Constants are similar to variables but, once defined, their value cannot be changed. Also the main syntax difference is constants are defined using the @const
keyword.
Variables defined outside of any logic blocks are considered global and can be modified and accessed throughout the entire code.
Variables can be accessed and modified anywhere in the code.
Variables defined within logic blocks are local to that block. They cannot be accessed outside the block in which they are defined.
Modify and optimize SQL code with the flexibility of variables
Variables and constants store values you can later use anywhere in your query.
Variables are placeholders that can be assigned and reassigned values throughout the SQL code.
To assign a value to a variable, use the equal sign =
followed by the value.
For example, take a look at the following Latitude Query, and what will actually be compiled and executed in the database:
Variables can be modified using operations such as addition.
Constants are similar to variables but, once defined, their value cannot be changed. Also the main syntax difference is constants are defined using the @const
keyword.
Variables defined outside of any logic blocks are considered global and can be modified and accessed throughout the entire code.
Variables can be accessed and modified anywhere in the code.
Variables defined within logic blocks are local to that block. They cannot be accessed outside the block in which they are defined.