i'm building a java program that basically manage a oracle xe 11.2g database using ojdbc6 driver. I wrote succesfully the methods to search and insert rows but the method that use delete statement do nothing at all.
private void eliminaDipartimento()
{
try {
PreparedStatement myStm =database.getConnessione().prepareStatement("DELETE FROM Dipartimento WHERE Cod_DIP=? ");
myStm.setString(1, textField_6.getText());
myStm.executeUpdate();
} catch (SQLException e) {new ErrorDialog("Impossibile cancellare il dato");}
}
database.getconnessione() get connection via oracle data source while ErrorDialog is basically only a dialog that show the error. Thanks a lot.
Try this:
PreparedStatement myStm =database.getConnessione().prepareStatement("DELETE FROM Dipartimento WHERE Cod_DIP=cast(? as char(5))");