![]() |
|
The intoasc() function converts the field values of an interval variable to an ASCII string that conforms to the ANSI SQL standard.
The intoasc() function converts the digits of the fields in the interval variable to their character equivalents and copies them to the outbuf character string with delimiters (hyphen, space, colon, or period) between them. You must initialize the interval variable in invvalue with the qualifier that you want the character string to have.
The character string does not include the qualifier or the parentheses that SQL statements use to delimit an INTERVAL literal. The outbuf string conforms to ANSI SQL standards. It includes one character for each delimiter (hyphen, space, colon, or period) plus fields with the following sizes.
Field | Field Size |
---|---|
Leading field | As specified by precision |
Fraction | As specified by precision |
All other fields | Two digits |
An interval value with the day(5) to fraction(5) qualifier produces the maximum length of output. The string equivalent contains 16 digits, 4 delimiters, and the null terminator, for a total of 21 bytes:
If you do not initialize the qualifier of the interval variable, the intoasc() function returns an unpredictable value, but this value does not exceed 21 bytes.