首页 > 其他 > 详细

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

时间:2015-04-22 15:27:10      阅读:125      评论:0      收藏:0      [点我收藏+]

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方法, 数值显示格式不一致的问题.

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!