DB2 - Problem description
Problem IT05478 | Status: Closed |
SQL0180N IS RETURNED WHEN QUERY HAS TIMESTAMP FUNCTION OVER HOST VARIABLE | |
product: | |
DB2 FOR LUW / DB2FORLUW / A50 - DB2 | |
Problem description: | |
SQL0180N The syntax of the string representation of a datetime value is incorrect. SQLSTATE=22007 when it has TIMESTAMP casting function out of a host variable. This can be identified in db2exfmt generated file. Search TIMESTAMP in the "Optimized Statement" of db2exfmt generated file, and see TIMESTAMP has host variable as an argument. If the host variable is of type VARCHAR, and the binding in literal of that host variable is invalid to be cast to TIMESTAMP, e.g. blank string '' is ineligible to being cast to timestamp constant in db2, executing the query could return SQL0180N error. In order to active this APAR fix, you would need to set the below DB2 registry setting (instance recycle is mandatory): db2set DB2_REDUCED_OPTIMIZATION=STAMP_ONCEONLY_OFF db2stop db2start | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * All * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to 10.5 FP6 or higher * **************************************************************** | |
Local Fix: | |
Replace the host variable literal value with valid string that can be cast to TIMESTAMP, for example: replace '' with NULL value and change the comparison logic from "hv=''" to "hv is null". | |
Solution | |
First fixed in DB2 10.5 FP6 | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 10.11.2014 14.06.2016 14.06.2016 |
Problem solved at the following versions (IBM BugInfos) | |
Problem solved according to the fixlist(s) of the following version(s) | |
10.5.0.6 |