【问题标题】:Create oracle trigger that will update a new column with the concatenated values of the updated columns创建将使用更新列的连接值更新新列的 oracle 触发器
【发布时间】:2011-03-10 07:10:31
【问题描述】:

我在 oracle 中有 firstName、lastName 和 fullName 列。我希望能够创建一个触发器,在更新或插入它们时使用 firstName 和 lastName 值更新 fullName 列。我认为这在 oracle 中是可能的。有没有人有任何想法。非常感谢。

【问题讨论】:

  • 为什么不在 INSERT 中进行串联?

标签: oracle oracle10g


【解决方案1】:

  create or replace trigger pick_a_name
   before insert or update
   on mytable
   for each row
 begin
    :new.full_name := :new.firstName ||' '|| :new.lastName;
 end pick_a_name;

【讨论】:

  • 这会影响表中的每个现有行,还是只影响要插入/更新的行?
猜你喜欢
  • 2019-05-03
  • 1970-01-01
  • 2021-01-05
  • 2012-04-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-25
  • 1970-01-01
相关资源
最近更新 更多