Oracle APEX Trigger - Can I affect 'Table A' when I execute a trigger on the insert of 'Table B'?
OK guys, here is my problem. I am trying to create a Trigger in Oracle APEX that will insert the 1st row on table 'APEX_LOGS' with the default values spelled out below when I submit a row for table 'MAIN_APEX'. Here is the trigger I am trying to run:
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;
Thoughts? This topic seems to be incredibly poorly documented. Even the 'Help' section gives no insight into proper formatting. Thanks guys.
You are confusing Apex and database concepts: triggers are part of the database, not of Apex.
The syntax for the trigger would be:
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;
精彩评论