What is the use of multiple templates within a control procedure?

  • 13 November 2020
  • 2 replies

Badge +4

I always thought that there could be one template to a control procedure, but just saw that it actually is possible to have more than one template to a control procedure.
Hope that someone tell me why they use multiple templates within the same control procedure. I'd like to know the advantages of using multiple templates.

2 replies

Userlevel 1
Badge +3

I also discovered this way late. I did merge all my seperate procs to one, and made different templates.

Not sure if this is better technically. However, is creates a lot more structure/overview.



Userlevel 4
Badge +8

This can be used if you have the same objects but you need some templates only in a certain object. Example: If you have insert/update and delete trigger on a table you can have template A, B and C. 

Update trigger has template A + B

Insert trigger has template   B + C

delete trigger has template  C

Now you need only 1 proc to house all the templates and you assign the necessary templates to the objects. Instead of 3 procs that you assign to multiple objects. 

One advantage is that you have all available templates in the same control proc. Otherwise you would have to switch between control procs. And you can keep the naming more object focused something like triggers_table_A instead of trigger_check_for_duplicates. Making the search for the template to amend easier. 

It's like you said it adds more structure if done correctly.