在 DB2 中为 CURRENT_TIMESTAMP 使用什么? [英] What to use in DB2 for CURRENT_TIMESTAMP?
本文介绍了在 DB2 中为 CURRENT_TIMESTAMP 使用什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将一些 MySQL 语句转换为 DB2 数据库,但在以下查询中遇到了问题
I am converting some of my MySQL statements to DB2 database, but I faced a problem on the following query
CREATE TABLE RFX_EVENT_MAPPING (
EVENT_TYPE varchar(4) NOT NULL,
EVENT_DESC varchar(50) NOT NULL,
EVENT_CLASS varchar(50) default NULL,
OWNER varchar(6) default NULL,
LAST_UPDATE_TIME timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
LAST_UPDATE_USER varchar(20) NOT NULL
);
如你所见
LAST_UPDATE_TIME timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
哪个不工作,我怎样才能使用 db2 实现相同的功能?
Which is not working so how can I achieve the same functionality with db2?
推荐答案
在 DB2 9.7 for Linux, UNIX, Windows 中,IBM 添加了行更改时间戳的概念.
In DB2 9.7 for Linux, UNIX, Windows, IBM added the concept of a row change timestamp.
create table rcttest (
c1 int,
c2 char(10),
insert_ts timestamp not null with default current timestamp,
change_ts timestamp not null generated always for each row
on update as row change timestamp
);
这篇关于在 DB2 中为 CURRENT_TIMESTAMP 使用什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文