INSERT function
The purpose of the INSERT
function is to add new records to a table. The syntax for the INSERT
function is as follows:
[BooleanValue :=] Record.INSERT ( [ TriggerControlBoolean ] )
If BooleanValue
is not used and the INSERT
function fails (for example, if the insertion would result in a duplicate Primary Key), the process will terminate with an error. Generally, we should handle a detected error in code by using the BooleanValue
and supplying our own error handling logic rather than allowing a default termination.
The TriggerControlBoolean
value controls whether or not the table's OnInsert
trigger fires when the INSERT
occurs. The default value is FALSE
. If we let the default FALSE
control, we run the risk of not performing error checking that the table's designer assumed would be run when a new record was added.
Tip
When we are reading a table and we also need to INSERT
records into that same table, the INSERT
should be done to a separate instance of the...