db2有两种办法可以显示当前的日期, 缺省的日期格式与创建数据库时的 territory code 有关系,例如我的环境中格式为 yyyy-mm-dd:
- $ db2 "values current date"
- 1
- ----------
- 2017-03-14
- 1 record(s) selected.
- $ db2 "SELECT current date FROM sysibm.sysdummy1"
- 1
- ----------
- 2017-03-14
- 1 record(s) selected.
参考上图,如果您想修改成 dd.mm.yyyy ,那么需要进入到sqllib/bnd目录,绑定db2ubind.lst的时候,指定datetime为EUR
- $ cd $HOME/sqllib/bnd
- $ db2 bind @db2ubind.lst datetime EUR blocking all grant public
- $ db2 "values current date"
- 1
- ----------
- 14.03.2017
- 1 record(s) selected.