码迷,mamicode.com
首页 > 其他好文 > 详细

V95和V97的char方法, 数值显示格式不一致的问题.

时间:2015-04-22 15:28:51      阅读:196      评论:0      收藏:0      [点我收藏+]

标签: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.

V95和V97的char方法, 数值显示格式不一致的问题.

标签:char数值显示格式

原文地址:http://masaly.blog.51cto.com/9302075/1637081

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!