Data retrieval errors

Sometimes when you issue a statement, it encounters an error.

If SQL finds that a retrieved character or graphic column is too long to be placed in a host variable, SQL does the following:

If SQL finds a data mapping error while running a statement, one of two things occurs:

Data mapping errors include:

For data mapping errors, the SQLCA reports only the last error detected. The indicator variable corresponding to each result column having an error is set to -2.

For data mapping errors on a multi-row FETCH, each mapping error reported as a warning SQLSTATE will have a separate condition area in the SQL diagnostics area. Note that SQL stops on the first error, so only one mapping error that is reported as an error SQLSTATE will be returned in the SQL diagnostics area.

For all other SQL statements, only the last warning SQLSTATE will be reported in the SQL diagnostics area.

If the full-select contains DISTINCT in the select list and a column in the select list contains numeric data that is not valid, the data is considered equal to a null value if the query is completed as a sort. If an existing index is used, the data is not considered equal to a null.

The impact of data mapping errors on the ORDER BY clause depends on the situation: