简体   繁体   English

SQL查询返回数据,但ResultSet为空

[英]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 我有这个简单的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? 我试图用if(rset.next())来捕获空的resultSet,但是它没有用,因为MIN()函数返回EVER 1行,尽管它是一个空行,所以我该怎么做才能捕获它?

Thanks in advance 提前致谢

Sorry I cannot prove my idea with running system but I would try to use wasNull() on result set: 抱歉,我无法用运行的系统证明我的想法,但是我会尝试在结果集上使用wasNull():

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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