A variable's type is what kind or style its values are. A
variable may have any Texis SQL type, e.g. varchar for a simple
text string, int for integers, or counter for a counter
field. The type of a variable depends on how it was assigned.
Returned variables from SQL statements (here)
have the type of the corresponding table column. An assignment
statement (here) determines the type of the
assigned-to variable from that of its arguments. The type of the
return value of user/builtin functions depends on the function.
Where needed, a variable's values are cast, i.e. copied and
changed to, a different type. For example, passing an integer
variable to a SQL statement that expects a varchar
field, will cause the integer value to be cast to a string. This
casting is usually done implicitly; in some rare cases, however, it
may not be possible and an error results (e.g. a varbyte type
cannot be cast to a date type).
A variable's type affects how it is used in expressions, most
notably comparisons. Integer values are compared numerically, so the
integer 123 is greater than the integer 45. Strings
(varchar type) however, are compared alphabetically, so the
string value "123" is less than the string
"45", just as "abc" is less than "de".