Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> trigger questions (on principle)
Hi ng,
there is a database with
- a schema DAT that contains the Data including all Tables and integrity
triggers that are necessary.
- a schema PRG that contains Data related to the Application (Menus,
Forms ...)
- a schema LOG that is only for protocolling of changes in main tables
of schema DAT
My questions are the following:
1.)
For integrity/redundancy there is a trigger in schema DAT like
CREATE Trigger1 BEFORE INSERT ON TableA OF Field1 FOR EACH ROW
Besides I need a Trigger like
CREATE Trigger2 BEFORE INSERT OR UPDATE ON TableA OF Field2 FOR EACH ROW
Should I
a) only create 1 Trigger like
CREATE TriggerBoth BEFORE INSERT OR UPDATE ON TableA OF Field1,Field2
FOR EACH ROW
in which I decide whether I insert or update and which Field is
implicated
b) create 1 Trigger for each field
c) create 1 Trigger for each event
2.)
If there are changes in an important Table the changes are to store in a
ChangeLog- Table, so that every state of a record can be controlled if
necessary.
So I want to write Triggers like
CREATE TriggerChange1 BEFORE INSERT OR UPDATE ON TableA FOR EACH ROW CREATE TriggerChange2 BEFORE DELETE ON TableA FOR EACH ROW
that creates a row in TableChangeLog.
I would prefer to seperately store the Triggers TriggerChange1 and
TriggerChange2 in the schema LOG but is there a possibility to manage
that
a) the ChangeLog- Triggers are called last
b) the ChangeLog- Triggers only are fired if a real change took place
(if the other Triggers abort these Triggers are to abort either?
Should be written instead of this stored procedures in LOG that are fired by triggers from schema DAT?
Hope I articulated understandable ...
Thanks
Andreas
-- wenn email, dann AndreasMosmann <bei> web <punkt> deReceived on Tue Aug 23 2005 - 05:14:40 CDT