简体   繁体   中英

SQL query returns data but ResultSet is empty

i have searched in so questions but there is nothing like my problem. I've this easy SQL

SELECT MIN(date) 
FROM table1 
WHERE date > date1 (obviously date1 is a parameter)

i tried to catch the empty resultSet with if(rset.next()) but it didn't work because MIN() function returns EVER 1 row though it is an empty row, so what can i do to catch it?

Thanks in advance

Sorry I cannot prove my idea with running system but I would try to use wasNull() on result set:

if (rs.next()) {
    date = rs.getDate(1);
    if (rs.wasNull()) {
     // do something
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM