6. Embedded SQL for BASIC : BASIC Variables and Data Types : Data Type Conversion : Runtime Numeric Type Conversion
 
Share this page                  
Runtime Numeric Type Conversion
The Ingres runtime system provides automatic data type conversion between numeric-type values in the database and forms system and numeric BASIC variables. The standard type conversion rules (according to standard VAX rules) are followed. For example, if you assign a real variable to an integer-valued field, the digits after the decimal point of the variable's value are truncated.
Runtime errors are generated for overflow on conversion when assigning Ingres numeric values into BASIC variables. Overflow caused by assigning BASIC numeric variables into Ingres numeric objects is likely to result in inconsistent data, but does not by default generate a runtime error. Using the -x flag on the Ingres statement changes this behavior by generating errors at runtime.
The BASIC decimal data type is converted to real double using BASIC assignment statements generated by the preprocessor. Variables of decimal data type can be converted twice at runtime, depending on the final Ingres type being set or retrieved from. The standard BASIC arithmetic conversion rules hold for all these generated assignment statements, with a potential loss of precision. For further information, see Decimal Data Type in this chapter.
The Ingres money type is represented as real double, an 8-byte floating-point value.