Declaring Keywords or Routine Names as SPL Variables

If you declare a variable with the same name as a keyword or as the name of a routine, ambiguities can occur. HCL OneDB™ uses the following rules for resolving name conflicts among SPL variables, UDR names, and built-in SQL function names.
  • Variable names that are declared in DEFINE statements take the highest precedence.
  • User-defined routines defined in CREATE PROCEDURE or CREATE FUNCTION statements take precedence over built-in SQL functions.
  • Procedures declared with the PROCEDURE keyword in the DEFINE statement take precedence over built-in SQL functions.
  • Built-in SQL functions take precedence over SPL procedures that exist in the database but that are not explicitly identified as procedures in the DEFINE statement.
Do not use the name of a built-in SQL function as an SPL variable if you might need to invoke the SQL function. For example, do not declare a variable with the name count or max, if you might also need to call those aggregate functions.