Implicit data conversion

When the program fetches a floating-point column value into a character host variable (char, fixchar, varchar, or string), it includes only the number of decimal digits that can fit into the character buffer. If the host variable is too small for the full precision of the floating-point number, rounds the number to the precision that the host variable can hold.

In the following code fragment, the program retrieves the value 1234.8763512 from a FLOAT column that is called principal into the prncpl_strng character host variable:
EXEC SQL BEGIN DECLARE SECTION;
   char prncpl_strng[15]; /* character host variable */
EXEC SQL END DECLARE SECTION;
;

EXEC SQL select principal into :prncpl_strng from loan
   where customer_id = 1098;
printf("Value of principal=%s\n", prncpl_strng);
Because the prncpl_strng host variable is a buffer of 15 characters, is able to put all decimal digits into the host variable and this code fragment produces the following output:
Value of principal=1234.876351200
However, if the preceding code fragment declares the prncpl_strng host variable as a buffer of 10 characters, rounds the FLOAT value to fit into prncpl_strng and the code fragment produces the following output:
Value of principal=1234.8764

assumes a precision of 17 decimal digits for FLOAT or SMALLFLOAT values. For DECIMAL(n,m), assumes m decimal digits.