Jeff Spiller
facere conceptum realem | ab initio ad finem
Pages
Home
About Me (The Highlights)
Contact
Cure Type I Diabetes
Saturday, May 1, 2010
Getting Groovy gStrings to work with sql queries
If you are building dynamic SQL queries with gstrings, you may have had issues embedding SQL date strings in them, the way I solved this was to explicitly define the query as a string:
date="{ts '2010-05-01 00:00:00'}"
String
query="""
SELECT
order_number
order_amount
FROM
orders
where
order_date >${date}
"""
sql.eachLine(query),{println it })
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)