标签:char数值显示格式
DB2V9.5:
db2 connect to sample
Database Connection Information
Database server = DB2/AIX64 9.5.7
SQL authorization ID = W95Q7A
Local database alias = SAMPLE
db2 "values char(dec(123))"
1
-------------
00000000123.
1 record(s) selected.
DB2V9.7:
db2 connect to sample
Database Connection Information
Database server = DB2/AIX64 9.7.7
SQL authorization ID = E97Q7A
Local database alias = SAMPLE
db2 "values char(dec(123))"
1
-------------
123
1 record(s) selected.
解决:
设置DEC_TO_CHAR_FMT参数.
db2 update db cfg using DEC_TO_CHAR_FMT V95
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
SQL1363W One or more of the parameters submitted for immediate modification
were not changed dynamically. For these configuration parameters, the database
must be shutdown and reactivated before the configuration parameter changes
become effective.
db2stop force
db2start
db2 connect to sample
db2 "values char(dec(123))"
1
-------------
00000000123.
1 record(s) selected.
DEC_TO_CHAR_FMT:
The setting of the parameter determines whether leading zeros and a trailing decimal characters are included in the result of the CHAR function. If you set the parameter to NEW, leading zeros and a trailing decimal characters are not included; if you set the parameter to V95, leading zeros and a trailing decimal characters are included.
When upgrading, for databases created before Version 9.7 and then upgraded to Version 9.7 or higher, the parameter dec_to_char_fmt is set to V95 by default.
标签:char数值显示格式
原文地址:http://masaly.blog.51cto.com/9302075/1637081