Fetch and insert into interval host variables
- When the in_qual field contains a valid qualifier, Informix®
ESQL/C checks
it for compatibility with the qualifier from the INTERVAL column value.
The two qualifiers are compatible if they belong to the same interval class: either year to month or day to fraction. If the qualifiers are incompatible, Informix® ESQL/C sets the SQLSTATE status variable to an error-class code (and SQLCODE is set to a negative value) and the select, update, or insert operation fails.
If the qualifiers are compatible but not the same, Informix® ESQL/C extends the column value to match the in_qual qualifier. Extending is the operation of adding or dropping fields within one of the interval classes of an INTERVAL value to make it match a given qualifier. You can explicitly extend INTERVAL values with the Informix® ESQL/C invextend() function.
- When the in_qual field does not contain a valid qualifier, Informix®
ESQL/C takes
different actions for a fetch and an insert:
- For a fetch, if the in_qual field contains zero or is not a valid qualifier, Informix® ESQL/C uses the INTERVAL column value and its qualifier to initialize the interval host variable.
- For an insert, if the in_qual field is not compatible with
the INTERVAL column or if it does not contain a valid value, Informix®
ESQL/C cannot
perform the insert or update operation.
Informix® ESQL/C sets the SQLSTATE status variable to an error-class code (and SQLCODE is set to a negative value) and the update or insert operation on the INTERVAL column fails.