首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

trigger的有关问题

2012-03-31 
trigger的问题数据库中每个表都有个ModifyTime字段,我想写个TRIGGER,每当insert or updata时可以把对应记

trigger的问题
数据库中每个表都有个ModifyTime字段,我想写个TRIGGER,每当insert or updata时可以把对应记录的这个字段更新为系统当前时间。

[解决办法]

SQL code
/--创建一个单表的insert和update触发器: Create or replace trigger biu_tabletest  Before insert or update On tabletest  for each rowbegin  if updating then    update tabletest set ModifyTime = sysdate;    elseif inserting then     insert into tabletest values(:field1, ...sysdate);  end if;end biu_tabletest; 

热点排行
Bad Request.