Variable and keyword ambiguity
If you declare a variable whose name is an SQL keyword,
ambiguities can occur. The following rules for identifiers help you
avoid ambiguities for SPL variables, SPL routine names, and built-in
function names:
- Defined variables take the highest precedence.
- Routines defined with the PROCEDURE keyword in a DEFINE statement take precedence over SQL functions.
- SQL functions take precedence over SPL routines that exist but are not identified with the PROCEDURE keyword in a DEFINE statement.
In general, avoid using an ANSI-reserved word for the name of the variable. For example, you cannot define a variable with the name count or max because they are the names of aggregate functions. For a list of the reserved keywords that you should avoid using as variable names, see the Identifier segment in the HCL OneDB™ Guide to SQL: Syntax.
For information about ambiguities between SPL routine names and SQL function names, see the HCL OneDB Guide to SQL: Syntax.