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 })

Posted by Jeff Spiller at 5:27 PM No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: date, groovy code, programming, sql
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Usefull Links

  • Project Management Institute
  • Seth Godin's Blog

Blog Archive

  • ►  2015 (5)
    • ►  July (2)
    • ►  June (1)
    • ►  May (2)
  • ►  2014 (4)
    • ►  April (1)
    • ►  February (1)
    • ►  January (2)
  • ►  2013 (22)
    • ►  December (3)
    • ►  November (8)
    • ►  September (2)
    • ►  June (2)
    • ►  May (1)
    • ►  April (1)
    • ►  March (3)
    • ►  January (2)
  • ►  2012 (16)
    • ►  December (3)
    • ►  November (4)
    • ►  October (3)
    • ►  September (1)
    • ►  June (1)
    • ►  April (2)
    • ►  March (1)
    • ►  February (1)
  • ►  2011 (8)
    • ►  December (1)
    • ►  November (2)
    • ►  September (3)
    • ►  July (1)
    • ►  May (1)
  • ▼  2010 (6)
    • ►  October (1)
    • ▼  May (1)
      • Getting Groovy gStrings to work with sql queries
    • ►  March (4)
Copyright 2000-2020 by Jeffrey Spiller. Awesome Inc. theme. Powered by Blogger.