Using Prepared Statements to set Table Name

后端 未结 7 1840
生来不讨喜
生来不讨喜 2020-11-22 11:57

I\'m trying to use prepared statements to set a table name to select data from, but I keep getting an error when I execute the query.

The error and sample code is di

7条回答
  •  遇见更好的自我
    2020-11-22 12:12

    A table name can't be used as a parameter. It must be hard coded. So you can do something like:

    private String query1 = "SELECT plantID, edrman, plant, vaxnode FROM [" + reportDate + "?]";
    

提交回复
热议问题