I have a type as 'designation' in my postgreSQL DB instance. I have a table named 'Prof' that has a column 'designation' of type 'designation'. I want to insert values into this column using java.
code snippet:
insProf.setInt(1, id);
insProf.setInt(2, univ_id);
insProf.setString(3, desg);
int rs_insProf = insProf.executeUpdate();
output error:
Enter designation: org.postgresql.util.PSQLException: ERROR: invalid input value for enum designation: ""
Please help with with syntax, I am not able to figure out how best I can handle this.
insProf.setObject(3, desg, Types.OTHER)designationtype accepts the empty string''? (It only accepts it, if you enumerated that too within the definition). You may want to useNULLinstead of the empty string.