Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6706201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:29:33+00:00 2026-05-26T07:29:33+00:00

I want to fire an update query , normally using groovy we do something

  • 0

I want to fire an update query , normally using groovy we do something like :

sql.executeUpdate("update MYTABLE l set field1  where l.id = ${someobj.id}")

The above works perfectly but my problem is that i dont know ahead how many parameters i need to update. So i made a function which returns the
properttoudate1 = value1 , propertytoupdate2 = value2 .. and so on..
Then i modified the above query to

sql.executeUpdate("update MYTABLE l set ${makeQueryString(propertiesToUpdate)} where l.id = ${someobj.id}")

Now it gives me the error::

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''PROPERTY1 = 1' where l.id = 'PROPERTVALUE1'' at line 1

ANY IDEAS ??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:29:33+00:00Added an answer on May 26, 2026 at 7:29 am

    You need to tell Groovy that the fieldname is a static, and shouldnt be replaced with ? by using Sql.expand:

    sql.executeUpdate("update MYTABLE l set ${Sql.expand(makeQueryString(propertiesToUpdate))} where l.id = ${someobj.id}")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to fire an event manually using c#. For instance, say if i
I have several sql queries that I simply want to fire at the database.
i am using chosen prototype. i want to update second select box based on
I've tried setting up an SQL Dependency to fire on a Count Rows query
I want a SQL trigger to fire when a table is updated. I have
I want to fire up a flash presentation inside Powerpoint 2007. I am calling
I have a periodically_call_remote that I want to fire right away (as if the
i have 2 divs next to each other i want mouseleave to fire when
I want to let TextBox control TextChanged event fire only when there are more
I want to have a generic event that I can fire that will take

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.