Previous Topic: SQL ParametersNext Topic: Expressions


SQL Variables

An SQL variable is a variable that is declared within a compound statement in an SQL Procedure (a LANGUAGE SQL procedure). In compound statements, SQL variables can be used anywhere expressions are allowed. They cannot be used outside of compound statements. If the name conflicts with (matches) another SQL variable name (for example from another compound statement such as a condition handler), an SQL parameter name, or a column contained within a referenced table or view, the SQL variable name should be qualified using the start-label of the compound statement that immediately contains it. The syntax of an SQL variable follows:

►►─┬────────────────┬─ variable-name ─────────────────────────────────────────►◄
   └─ start-label. ─┘