home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Neueste VersionenFixList
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Haben Sie Probleme? - Kontaktieren Sie uns.
Kostenlos registrieren anmeldung-x26
Kontaktformular kontakt-x26

DB2 - Problembeschreibung

Problem IC83801 Status: Geschlossen

VARCHAR RESULT DATA TYPE INSTEAD OF CHAR WITH VARCHAR2 ENABLED DATABASE

Produkt:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problembeschreibung:
When doing a describe command on a select query, the result data 
type in a VARCHAR2 enabled database may be VARCHAR instead of 
the expected CHAR. 
 
Example: 
---------------------------------------------------------------- 
 
C:\>db2 create table test(c1 int) 
DB20000I  The SQL command completed successfully. 
 
>> A) Output from the describe select command with the issue: 
C:\>db2 "describe select 'Y' as flag1, case when 1 = 1 then 'Y' 
else 'N' end as flag2 from test" 
 
 Column Information 
 
 Number of columns: 2 
 
 SQL type              Type length  Column name         Name 
length 
 --------------------  ----------- 
------------------------------  ----------- 
 452   CHARACTER                 1  FLAG1                5 
 448   VARCHAR                   1  FLAG2                   5 
 
 
>> B) Expected output : 
C:\>db2 "describe select 'Y' as flag1, case when 1 = 1 then 'Y' 
else 'N' end as flag2 from test" 
 
 Column Information 
 
 Number of columns: 2 
 
 SQL type              Type length  Column name 
Name length 
 --------------------  ----------- 
------------------------------  ----------- 
 452   CHARACTER                 1  FLAG1                   5 
 452   CHARACTER                 1  FLAG2                   5 
 
The effects of setting the varchar2_compat database 
configuration parameter to ON are as follows. 
 
Rules for result data types involving character strings are 
modified as follows: 
 
 
If one operand is...  And the other operand is...  The data type 
of the result is... 
CHAR(x)  CHAR(x)  CHAR(x) 
CHAR(x)  CHAR(y)  VARCHAR(z) where z = max(x,y) 
 
 
 
Rules for result data types involving graphic strings are 
modified as follows: 
 
If one operand is...  And the other operand is...  The data type 
of the result is... 
GRAPHIC(x)  GRAPHIC(x)  GRAPHIC(x) 
GRAPHIC(x)  GRAPHIC(y)  VARGRAPHIC(z) where z = max(x,y) 
 
 
 
Rules for result data types involving character and graphic 
strings are modified as follows: 
 
If one operand is...  And the other operand is...  The data type 
of the result is... 
GRAPHIC(x)  CHAR(y)  VARGRAPHIC(z) where z = max(x,y) 
 
 
 
The functions that return character string arguments, or that 
are based on parameters with character string data types, also 
treat empty string CHAR, NCHAR, VARCHAR, or NVARCHAR values as 
null values. Special considerations apply for some functions 
when the varchar2_compat database configuration parameter is set 
to ON, and these are listed here. 
 
    DECODE: If the first result expression is an untyped null it 
is assumed to be VARCHAR(0).  If the first result expression is 
CHAR or GRAPHIC, it is promoted to VARCHAR or VARGRAPHIC. 
    GREATEST: If the first expression is CHAR or GRAPHIC, it is 
promoted to VARCHAR or VARGRAPHIC. 
    LEAST: If the first expression is CHAR or GRAPHIC, it is 
promoted to VARCHAR or VARGRAPHIC. 
    NVL: If the first expression is CHAR or GRAPHIC, it is 
promoted to VARCHAR or VARGRAPHIC. 
    NVL2: If the result expression is an untyped null it is 
assumed to be VARCHAR(0).  If the result expression is CHAR or 
GRAPHIC, it is promoted to VARCHAR or VARGRAPHIC.
Problem-Zusammenfassung:
Local-Fix:
Cast the final result to CHAR(N)
verfügbare FixPacks:
DB2 Version 9.7 Fix Pack 7 for Linux, UNIX, and Windows
DB2 Version 10.1 Fix Pack 2 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 8 for Linux, UNIX, and Windows
DB2 Version 10.1 Fix Pack 3 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9 for Linux, UNIX, and Windows
DB2 Version 10.1 Fix Pack 4 for Linux, UNIX, and Windows
DB2 Version 10.1 Fix Pack 3a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 10 for Linux, UNIX, and Windows
DB2 Version 10.1 Fix Pack 6 for Linux, UNIX, and Windows

Lösung
Workaround
keiner bekannt / siehe Local-Fix
Kommentar
When doing a describe command on a select query, the result data 
type in a VARCHAR2 enabled database may be VARCHAR instead of 
the expected CHAR. This happens when all the data types are 
CHAR(N) where N is the same for all values.
Bug-Verfolgung
Vorgänger  : APAR is sysrouted TO one or more of the following: IC91701 IC91702 
Nachfolger : 
Weitere Daten
Datum - Problem gemeldet    :
Datum - Problem geschlossen :
Datum - der letzten Änderung:
28.05.2012
06.11.2012
17.06.2013
Problem behoben ab folgender Versionen (IBM BugInfos)
Problem behoben lt. FixList in der Version
9.7.0.7 FixList
10.1.0.2 FixList
10.5.0.2 FixList