问题
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