Created
May 9, 2015 00:44
-
-
Save dclucas/231d2f5b577823f39742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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