I want to make this query:
Class.forName("org.postgresql.Driver");
Connection conn= null;
conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgis","postgres","123456");
PreparedStatement ps = null;
String sql = "SELECT num FROM parcels WHERE code_initial_right =(SELECT code_document FROM documents WHERE number_document=? or date_document='"+docd+"')";
ps = conn.prepareStatement(sql);
ps.setString(1,docn);
ResultSet rs = ps.executeQuery();
But docd can be equals null. When i try this i get an error:
javax.servlet.ServletException: org.postgresql.util.PSQLException: ERROR: invalid input syntax for type date: ""
What can i do with this?
if. :)ifin case whendocd=nullassigndocdto randomdate?