Resultset Java Return Null. Moreover the standard way to check whether a ResultSet is empty or not is to try setting its cursor to first row by using its first and if it returns false it indicates that ResultSet is empty. The javasqlResultSet interface represents such tabular data returned by the SQL statements.
So I have the following issue. A SQL query returns a ResultSet containing the requested data. Retrieving the Value of a Column Using the Index Number.
Moreover the standard way to check whether a ResultSet is empty or not is to try setting its cursor to first row by using its first and if it returns false it indicates that ResultSet is empty.
So for a client code accessing the above APIs there is no need for a null check. It rather throws an Exception. Thats not the best solution if you dont have a forward only type. The default for ResultSetgetInt when the field value is NULL is to return 0 which is also the default value for your iVal declaration.