Database triggers

There are distinct database triggers available which fire on the create and write events on a database table. You can define them in the data dictionary tool so that they are part of the database schema or you can define them in a procedure. Defining them in the database scheme makes sure that they are always fire ( only 4GL not SQL clients ) whereas defining them in the session they will only fire for that particular 4GL session.

But you need to aware, regardless where you define them they are always executed by the client and not by the database engine. Plus the create trigger immediately fires after the create event has taken place ( which allows you to populate for example the unique record identifier automatically ) and the write trigger fires at the end of the buffer scope or transaction scope, whichever comes first. This is important to know when you need to catch an error from a database trigger.

Heavy Regards, RealHeavyDude.
 
Create event fires when DB records created by create tablename operator. Other fields = default values.
When records writes to DB it is possible to identify what is record type (new or modified)

TRIGGER PROCEDURE FOR WRITE OF tablename OLD BUFFER old-tablename.

if NEW tablename then /* record just created and writes first time to DB */
do:
do something with new record.
end.
else do:
do something or compare old-tablename and tablename record buffers.
end.
 
I would have thought therefore, that no it's not possible. The only option I can think of is to have 2 distinct triggers that both call out to the same .p
 
Back
Top