public static void inserel(String tabela, String campo, String valor)
throws SQLException{
PreparedStatement stm = null;
// monta sql
String sql = "INSERT INTO " +
tabela +
" (" +
campo +
") VALUES (?) ON DUPLICATE KEY UPDATE " +
campo +
" = VALUES(?)";
try {
// executa comando
stm = CONEXAO.prepareStatement(sql);
stm.setString(1, valor);
stm.setString(2, valor);
stm.executeUpdate();
} finally {
if (stm != null)
try {
stm.close();
} catch (SQLException e) {}
}// finally
}// end of insere
pq essa funçaõ apresenta erro de sintaxe sql ?