I have a problem with a prepareStatement. I am trying to build a query to select the count but table names are different and the code is like this:
String sql = "SELECT COUNT(0) AS CNT FROM ? WHERE STUD_NM <> 'ABC' ";
String tableName;
for (int i = 0; i < studCode.size(); i++) {
count = 0;
tableName = "";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , "S_"+studCode.get(i));
Syso(pstmt); //
}
Query is prepared like,
"SELECT COUNT(0) AS CNT FROM 'S_HUBRECORD' WHERE STUD_NM <> 'ABC'"
Why does it append single quotes to table name?