refactoring of pl/sql templates