Simplified Insert Trigger

The automatically generated insert triggers on the latest views have been simplified such that attribute metadata values default to the anchor metadata value if not specified. This makes insertion into the view (in order to create a new instance of the anchor and all attributes) as simple as the following code shows:

insert into lAC_Actor (
    Metadata_AC,
    AC_NAM_Actor_Name,
    AC_NAM_ValidFrom,
    GEN_Gender,
    PLV_ProfessionalLevel,
    AC_PLV_ValidFrom
)
values (42, 'Lars S', '1972-08-20', 'Male', 'Master', '2009-09-21'); 

If there is a need to ‘update’ the name this can also be done using the insert trigger on the latest view (given that the surrogate key generated for AC_ID in the previous step was 1):

insert into lAC_Actor (
    AC_ID, 
    AC_NAM_Actor_Name, 
    AC_NAM_ValidFrom,
    Metadata_AC_NAM
)
values (1, 'Lars R', '2004-06-19', 43);

Published by

Lars Rönnbäck

Co-developer of the Anchor Modeling technique. Programmer of the online modeling tool. Site maintainer. Presenter and trainer.

Leave a Reply

Your email address will not be published. Required fields are marked *