What is the correct way to include a variable inside an Apache derby Export_Query

久未见 提交于 2020-01-15 11:09:07

问题


I am trying to export data from a derby table to a file. I'm having issues with the WHERE clause. What I have is this.

s.execute("CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY('SELECT *FROM REPORT WHERE DATE = " + conversion.getDate() + " ' , 'C:\\Pos\\daily_report.csv' , ',' , null, null)");

This exception

Java.sql.SQLSyntaxErrorException: Syntax error: Encountered "Sep" at line 1, column 37.

was thrown while evaluating an expression.

Could someone direct me regarding this.


回答1:


I found it.

s.execute("CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY('SELECT*FROM REPORT WHERE DATE = ' ' " + conversion.getDate() + " ' ' ' , 'C:\Pos\daily_report.csv' , ' , ' , null, null)");



来源:https://stackoverflow.com/questions/39359923/what-is-the-correct-way-to-include-a-variable-inside-an-apache-derby-export-quer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!