... begin if inserting then do the required stuff.. elsif updating then do the required stuff... elsif deleting then do the required stuff... end if; end;
So my question is: How can I determine if it was an INSERT, UPDATE or DELETE command which fired this trigger.So you have one BEFORE/AFTER INSERT OR UPDATE OD DELETE trigger, right? Then in triiger body yoy can reference INSERTING, UPDATEING, DELETEING. For example:
. . . IF INSERTING THEN ... ELSIF UPDATING THEN ... ELSE ... -- DELETING logic END IF; . . .
If more than one type of DML operation can fire a trigger (for example, ON INSERT OR DELETE OR UPDATE OF Emp_tab), the trigger body can use the conditional predicates INSERTING, DELETING, and UPDATING to check which type of statement fire the trigger.
the keywords inserting, updating and deleting, which you use in the if clauses, are Oracle functions or?Yes, they are already there for you, if that's what you mean.
how do I know what happened?Oracle knows, and it's up to you how to handle the different action that should be taken, hence the IF ...THEN... construction.