When I execute these codes I got a error message: Exception in thread "main" java.sql.SQLException: Invalid operation for read onl y resultset: updateDouble at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:187) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:229) at oracle.jdbc.driver.BaseResultSet.updateDouble(BaseResultSet.java:225) at oracle.jdbc.driver.OracleResultSet.updateDouble(OracleResultSet.java:2816) at MonthlyBillGeneration.main(MonthlyBillGeneration.java:34)
What could be the reason I cannot update my result set?
Just because you asked for an updateable cursor doesn't mean you got one. The database is giving you a read only cursor for any/all of the following reasons:
- just not supported - you haven't selected the tables primary key as part of your select - the query has a joing - the database doesn't support a cursor that is BOTH updatable and scrollable
If you add the primary key field to your query and it still doesn't work then you need to consult the documentation for your database as to when you get which type of cursor. Again not all cursor modes are supported by all databases in all circumstances. So there is something about your request that isn't supported and you'll have to find out what.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com