# 1

# Spremenljivke v kodi SQL

Variables (sometimes refered to as placeholders) are places in SQL code which are replaced by actual values when the SQL code is executed. The benefits are faster execution times (as the SQL code is parsed only once) and a protection against SQL injection vulnerabilities.

Variables can be used in any SQL code, and are defined using the following syntax:

##<variable name>[::<variable type>[::NULL]]

Opombe:

the variable name can contain any SQL identifier character or among the `+-.|@?`characters (no space allowed)

the variable type can be among: `string`, `boolean`, `int`, `date`, `time`, `timestamp`, `guint`, `blob` and `binary`

the `::NULL` can be appended to specify that the variable may take the special `NULL` value.

Primeri:

##name::string ##id::int::NULL ##sales@3::date::NULL ##customers@id::int