且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从结果集中获取Double而不是double?

更新时间:2023-02-06 10:00:12

您可以检查 wasNull 在ResultSet上查找值是否为 null


请注意您必须首先调用列上的其中一个getter方法以尝试读取其值,然后调用方法wasNull以查看读取的值是否为SQL NULL。

Note that you must first call one of the getter methods on a column to try to read its value and then call the method wasNull to see if the value read was SQL NULL.

如果你之后确实需要一个 Double ,你可以从返回 double

If you really need a Double afterwards, you can create it from the double returned.