Summary of DML statements in key triggers thread

From: Glenn Nicholas <Glenn_at_wplace.demon.co.uk>
Date: Mon, 4 Jul 1994 13:26:45 +0000
Message-ID: <773328405snz_at_wplace.demon.co.uk>


Here is a summary of the mail responses to my posting about using DML statements in key triggers. General consensus seems to be that it works fine if you are careful. Thanks for all contributions.

: Has anybody had experience with the use of an insert statement
: from a key-nxtfld trigger, either in Forms 3 or Forms 4.
 

: I always believed this was impossible, but it appears otherwise.
: Oracle confirm it works under Forms 3 but is unsupported. Apparently
: it IS supported under Forms 4 however.


        I have done inserts, etc based on a key-nxtfld and others.

	It works fine. I believe the problem is that you have to do
	all the work. Confirm data is available and should be inserted, etc.
	I have just used such a mechanism to update a table that is 
	reference but not normally updated by the user.  It only updated
	the table if the user selected a specific entry. Otherwise,
	the information was discarded.

	Often it is safer (read easier) to create an appropriate block
	associated with that table and allow changes to be handled by
	Oracle.


dunno about Forms 4 (yet), but in version 3 it's perfectly safe as long as you understand that your insert will not be committed until forms goes through it's normal commit processing, which it probably won't do unless some database field in your form is updated/inserted.


I have used insert statements like this to create log records before. Never had any problems besides having to force Oracle to do a real COMMIT by using a dummy block on a one column dummy table.


Please do not use any DML Statements in Key-triggers unnecessarily.

Since the key-triggers fire for every tab on the <NXTFLD> when the user presses. Hence everytime the insertion will occur and data redundancy will happen. It is very unsafe to use.

Use the Post-Insert or Pre-insert triggers, according to your logic.

Also don't use key-nxtfld during validation on a particualr field, since the form status will change and possible commit will occur. Use especially on-validate-field trigger for validation purpose.

Pls get back to me if it works.


-- 
Glenn Nicholas, Concept             |   Internet: Glenn_at_wplace.demon.co.uk
Ph: +44 908 221313                  | Compuserve: 100070,3562
Received on Mon Jul 04 1994 - 15:26:45 CEST

Original text of this message