int rows = 0;
ResultSet rslt = null;
PreparedStatement pstmt = null;
String insert =
"insert into person_identifier_type " +
"( code, description, inactive_date ) " +
"values " +
"( ?, ?, ? )";
String delete =
"delete person_identifier_type " +
"where code = ?";
try {
System.out.println(insert);
pstmt = conn.prepareStatement(insert);
((OraclePreparedStatement)pstmt).defineParameterType(
1, Types.VARCHAR, 30);
((OraclePreparedStatement)pstmt).defineParameterType(
2, Types.VARCHAR, 80);
pstmt.setString( 1, "SID" );
pstmt.setString( 2, "Student Id" );
pstmt.setNull( 3, Types.TIMESTAMP );
rows = pstmt.executeUpdate();
System.out.println(rows + " rows inserted");
System.out.println("");
pstmt.close();
pstmt = null;
}
catch (SQLException e) {
System.err.println(e.getMessage());
}
finally {
if (pstmt != null)
try { pstmt.close(); } catch (SQLException ignore) { }
}
try {
System.out.println(delete);
pstmt = conn.prepareStatement(delete);
((OraclePreparedStatement)pstmt).defineParameterType(
1, Types.VARCHAR, 30);
pstmt.setString( 1, "SID" );
rows = pstmt.executeUpdate();
System.out.println(rows + " rows deleted");
}
catch (SQLException e) {
System.err.println(e.getMessage());
}
finally {
if (pstmt != null)
try { pstmt.close(); } catch (SQLException ignore) { }
}