Oracle APEX触发器 - 当我在'表B'的插入上执行触发器时,是否可以影响'表A'?

时间:2011-10-07 19:45:20

标签: oracle triggers oracle-apex

好的伙计们,这是我的问题。我正在尝试在Oracle APEX中创建一个触发器,当我为表'MAIN_APEX'提交一行时,将在表'APEX_LOGS'上插入第一行,并使用下面拼写的默认值。这是我试图运行的触发器:

CREATE OR REPLACE TRIGGER  "DEFAULT_LOG_ENTRY" AFTER insert on "MAIN_APEX" for each row 
 begin
  :new.APEX_LOGS.LOG_ENTRY:= 'This log page was established. Actions and communcations are captured from this date and time onward.';
  :new.APEX_LOGS.LOG_DATE:= sysdate();
  :new.APEX_LOGS.CIRCULATION:= 'External';
  :new.APEX_LOGS.MAIN_PK_REF:= &MAIN_APEX.MAIN_PK;
  :new.APEX_LOGS.TECHWRITER:= &MAIN_APEX.TECHWRITER;
 end;

思考?这个话题似乎记录得非常糟糕。即使是“帮助”部分也无法深入了解正确的格式。谢谢你们。

1 个答案:

答案 0 :(得分:2)

您对Apex和数据库概念感到困惑:触发器是数据库的一部分,而不是Apex。

触发器的语法是:

CREATE OR REPLACE TRIGGER  "DEFAULT_LOG_ENTRY" AFTER insert on "MAIN_APEX"
for each row 
 begin
  insert into apex_logs (log_entry, log_date, circulation,
                         main_pk_ref, techwriter)
  values ('This log page was established. Actions and communcations are captured from this date and time onward.'
         , sysdate
         , 'External'
         , :new.main_pk
         , :new.TECHWRITER);
 end;