Multi-line SQL in variable does not work in SQL JOBS

Document ID : KB000084565
Last Modified Date : 14/04/2018
Show Technical Document Details
Issue:
Error Message :
Incorrect syntax near ','.
U02004025 Job-script execution was aborted.

In SQL JOBS that contain multiple lines of SQL the carriage returns works. 

However, when a multi-line query is provided to the SQL JOBS via a variable coming from a VARA EXEC or SCRI object the same query fails.

This is the situation:
  • The process tab of the SQL JOBS simply contains a variable (&SQL_QUERY#)
  • A VARA EXEC or SCRI defines the variable &SQL_QUERY# and calls the SQL JOBS (as an executable object or with ACTIVATE_UC_OBJECT respectively)
  • When the defined variable does not contain carriage returns this mechanism works.
  • When the variable contains multiple lines the SQL JOBS will fail 
 
Environment:
OS: All
Cause:
Cause type:
By design
Root Cause: N/A
Resolution:
Remove carriage returns from the SQL query when the query is part of a variable.

Fix Status: No Fix

Additional Information:
Workaround :
N/A