Here is my code:
var qryStr = \"
UPDATE templates_email
SET title = :title, test_emails = :testEmail, body = :body
WHERE
This error occurs because of the tab and line break characters found in your SQL statement. I normally run below function on my SQL statement to remove these characters.
string function cleanSQL(required string sqlStatement)
output="false"
{
return trim(reReplace(arguments.sqlStatement, "\t|\n", " ", "all"));
}
So, your setSQL() can look like:
q.setSQL(cleanSQL(qryStr))
or simply:
q.setSQL(reReplace(qryStr, "\t|\n", " ", "all"))