How i can use a variable for the name of table in this type of request sql ?
Code :
String table="QUESTIONS_GEST";
PreparedStatement pst=conn.prepareStatement("SELECT COUNT(*) FROM TABLE(?)");
pst.setString(1,table);
ResultSet r=pst.executeQuery();
r.next();
System.out.println(r.getInt(1));
Output :
org.postgresql.util.PSQLException: ERROR: syntax error at or near "TABLE"
Position : 22
Thanks a lot for your help ! ;)