DB2 - Problem description
Problem IT25305 | Status: Closed |
SQL0332N WITH NVL2 FUNCTION AND VARCHAR FOR BIT DATA AND GRAPHIC | |
product: | |
DB2 FOR LUW / DB2FORLUW / B10 - DB2 | |
Problem description: | |
NVL2 produces error SQL0332N if the first argument is FOR BIT DATA and the second and third arguments are GRAPHIC (or vice-versa). For example: create table MYSCHEMA.TEST ( graphiccol GRAPHIC(4) -- any other type is fine ); All these examples incorrectly produce an error due to mix of GRAPHIC and character string FOR BIT DATA: select NVL2(RID_BIT(test), test.graphiccol, test.graphiccol) FROM MYSCHEMA.TEST test; SQL0332N Character conversion from the source code page "1200" to the target code page "0" is not supported. SQLSTATE=57017 select NVL2(cast(RID_BIT(test) as varchar(16)),test.graphiccol, test.graphiccol) FROM MYSCHEMA.TEST test; SQL0332N select NVL2(cast('blabla' as varchar(16) for bit data) , test.graphiccol, test.graphiccol) FROM MYSCHEMA.TEST test; SQL0332N This works fine since the first argument is not FOR BIT DATA: db2 "select NVL2(cast('blabla' as varchar(16)) , test.graphiccol,test.graphiccol) as column1 FROM MYSCHEMA.TEST test" COLUMN1 -------- 0 record(s) selected. | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to Db2 11.1 Mod 4 Fix Pack 5 or use local fix * **************************************************************** | |
Local Fix: | |
Cast the GRAPHIC expression(s) to VARGRAPHIC or use the equivalent CASE expression instead of NVL2 CASE WHEN expression IS NOT NULL THEN result-expression ELSE else-expression END | |
Solution | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 08.06.2018 10.03.2020 10.03.2020 |
Problem solved at the following versions (IBM BugInfos) | |
Problem solved according to the fixlist(s) of the following version(s) |