oracle
create_time: "CREATE_TIME" DATE DEFAULT SYSDATE,
update_time: 需要用到触发器,
CREATE OR REPLACE TRIGGER TABLE_NAME_TG
BEFORE INSERT OR UPDATE ON TABLE_NAME FOR EACH ROW
BEGIN
SELECT sysdate INTO:NEW.UPDATE_TIME FROM DUAL;
END;
MySql
自动初始化和更新: (update_time)
DEFAULT CURRENT_TIMESTAMP ON UPDATECURRENT_TIMESTAMP
只自动初始化: (create_time)
DEFAULT CURRENT_TIMESTAMP
只自动更新:
DEFAULT 0 ON UPDATE CURRENT_TIMESTAMP