Sql 使用触发器用当前的_时间戳更新特定列,它表示触发器已创建但未更新
这是您的Sql 使用触发器用当前的_时间戳更新特定列,它表示触发器已创建但未更新,sql,Sql,这是您的更新: create or replace trigger trg1 before insert on patient referencing old as old new as new for each row begin if inserting then update patient set p_join_date = current_timestamp where :old.patient_id= null; end if; end; 中的的计算结果永远不会为
更新
:
create or replace trigger trg1
before
insert on patient
referencing old as old new as new
for each row
begin
if inserting then
update patient set p_join_date = current_timestamp where :old.patient_id= null;
end if;
end;
中的
的计算结果永远不会为true,因此不会更新任何行。大概你的意图是:
update patient
set p_join_date = current_timestamp
where :old.patient_id = null;
触发器是高度特定于供应商的,因此请添加一个标记来指定您使用的是mysql
、postgresql
、sqlserver
、oracle
还是db2
——或者其他完全不同的东西。
update patient
set p_join_date = current_timestamp
where :old.patient_id is null;