Skip to content

Instantly share code, notes, and snippets.

@dclucas
Created May 9, 2015 00:44
Show Gist options
  • Save dclucas/231d2f5b577823f39742 to your computer and use it in GitHub Desktop.
Save dclucas/231d2f5b577823f39742 to your computer and use it in GitHub Desktop.
import groovy.text.SimpleTemplateEngine
def rawTemplate = '''CREATE OR REPLACE TRIGGER ${owner}.${entityName}_INSERT
AFTER INSERT
ON ${owner}.${tableName}
WHEN
${ columns.collect( { " old.$it <> new.$it" } ).join(/\n/) }
BEGIN
END'''
def engine = new SimpleTemplateEngine()
def tpl = engine.createTemplate(rawTemplate)
def output = tpl.make(
[ owner: 'ismaile',
tableName: '4201',
entityName: 'SalesOrder',
columns: ['IBITM', 'IBMCU', 'IBLITM' ]])
println output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment