X012: Type mismatch while doing comparison.

An attempt was made to compare two incompatible data types. Numeric types may be compared to other numeric types (including, for example, money and numeric results of date arithmetic or string functions); dates can only be compared to dates, character strings to character strings, times to times.

This error can also be returned if a FETCH statement is returning data into a data structure, and the data structure associated with the FETCH statement is not exactly the same as the data structure associated with the DECLARE CURSOR statement. Look for transposed columns, or missing columns in one of the data structures. For example, if the engine is returning numeric data in the cursor into a character field in the fetch, this error is returned.