Question Buffer in Trigger

Hi,

I have a doubt in buffers created while database triggers are fired. I am aware that 2 buffers are available in write trigger (new & old buffer).

Now my questions, 1. Is there a possibility that the old buffer will be blank at any situation?
2. Will the write trigger be fired while a new record is created?

If any further details required please let me know. Kindly clarify my questions.
 

RealHeavyDude

Well-Known Member
The write and delete triggers fire at the end of the buffer or transaction scope - whichever comes first. When you create a record the create trigger fires when the CREATE statemante is excuted and the write trigger fires at the end of the buffer or transaction scope. Obviously, when creating a record the old buffer will not be populated. In any event, in a write trigger, when you use the old buffer, you need to check first whether it contains a record or not before you go and execute a logic against it.

Almost forgot: I would not recommend using the write or delete trigger in a modern application design. Instead you should put that logic in the the central piece of logic that updates a given table. Plus, you need to be aware that such triggers only fire on behalf of 4GL clients in the context of the session that executes the respective commands.

Heavy Regards, RealHeavyDude.
 
Top