Implicit Data Types of Literals
Literals express values outside of pre-defined application objects. Because literals have no definition in the Object Dictionary, the software assumes a data type for each literal. This implicit data type is determined based on the characters contained in the value, and on whether or not the value is enclosed in quotation marks.
Literals that are enclosed in quotation marks, or that are unquoted but contain letters, are assumed to be character strings. Character strings are always implicitly CHAR.
Unquoted literal values that contain only digits, or digits and a decimal point are assumed to be numbers. Number literals are always implicitly VASTINT.
Constants (literals defined as objects, with names, in the Object Dictionary) can be assigned either the CHAR or VASTINT data type. No other type is permitted. The assigned data type overrides the data type implicit in the value of the constant.
Examples of Implicit Data Types
|1234||Is implicitly VASTINT.|
|abcd||Is implicitly CHAR.|
|2.6||Is implicitly VASTINT.|
|a1b2||Is implicitly CHAR.|
|‘1234’||Is implicitly CHAR.|
|‘ abcd’||Is implicitly CHAR.|
|‘-2.6’||Is implicitly CHAR.|
|‘a1b1’||Is implicitly CHAR.|