Fetch phase warnings and errors

Last updated: Mar 17, 2025
Fetch phase warnings and errors

Fetch phase warning and error messages give you extra insight into problems that might occur when you retrieve results after a query first runs.

These messages encompass a range of potential issues such as network disruptions, resource depletion problems (such as thread and memory constraints), SQL exceptions, and warnings that originate from the remote data source. Fetch phase warnings and errors are enabled by default, and you can turn it on and off in Enabling and disabling fetch phase warnings and errors in Data Virtualization.

Fetch phase messages are categorized into warnings and errors:
  • Warning: When a fetch phase warning occurs, an SQL warning message along with the result set is sent to you. Despite the warning, the query still finishes fetching the data that you requested.

    In the following example, the virtualized table NANINFTEST contains unsupported values INF (positive infinity) and NAN (negative infinity). The SQL warning message displays eight selected records and the first occurrence of the fetch phase warning. Subsequent warnings are not shown in the example.
    db2 "select *  from admin.,NANINFTEST". 
    
    C1	C2
    -----   ---------------------
    А	+1.12300000000000E+000
    B	-
    SQL1829W The federated server received the warning message "FETCH_WARN" from the data source "DV-FMP". The associated text and tokens are "The resulting value is outside the range for the dat". SQLSTATE=01680
    C	-
    D	+1.12300000000000E+000
    A	+1.12300000000000E+000
    B	-
    C	-
    D	+1.12300000000000E+000
  • Error: When a fetch phase error occurs, the query stops and an error message is sent back to you. The data fetched up to this point is also displayed. To find out why your query stopped, check the SQL state that is linked to the error message and look up the error code in SQLSTATE Messages.

    In the following example, the virtualized table comparison_test2 has an error code of 22008. This error code links to the error: Datetime field overflow occurred; for example, an arithmetic operation on a date or timestamp has a result that is not within the valid range of dates.

    db2 "select date(i) from admin.comparison_test2;"
    
    1
    SQL1822N Unexpected error code "FETCH_ERROR" received from data source "DV-FMP". Associated text and tokens are "Query fetch aborted: REMOTE_SQL_STATE: 22008". SQLSTATE=560BD
    DB20000I The TERMINATE command completed successfully.