Hi,
I am using PreparedStatement for table retrieval. I would need to fetch the records with column value null. Table Column is VARCHAR2 type.
String query = "SELECT * FROM <table_name> WHERE <col_name> = ?";
PreparedStatement ps = c.prepareStatement(query);
ps.clearParameters();
ps.setNull(1, Types.VARCHAR);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
}
Here, if I set null value, like above, for the where condition, it cannot able to fetch the record even though for this column, table value is null.
If I use the query, SELECT * FROM <table_name> WHERE <col_name> is null, it can fetch the record.
Can anyone please help. thanks