Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 405581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:24:48+00:00 2026-05-12T17:24:48+00:00

Given the following function: create or replace FUNCTION GETADDRESSES RETURN sys_refcursor IS address_cursor sys_refcursor;

  • 0

Given the following function:

create or replace FUNCTION "GETADDRESSES"
    RETURN sys_refcursor
IS
    address_cursor sys_refcursor;
BEGIN
    OPEN address_cursor FOR 
        SELECT * FROM Address;
    RETURN address_cursor;
END;

I would like to be able to make changes to this result set in Java and post the changes back to the database. It is called in Java with the following:

        String genericQuery = "{ call ? := getAddresses() }";
        CallableStatement stmt = connection.prepareCall(genericQuery, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);

       stmt.registerOutParameter(1, OracleTypes.CURSOR);
       stmt.execute();
       ResultSet rs = (ResultSet)stmt.getObject(1);
       while (rs.next())
       {
           System.out.println (rs.getString(2)); 
           rs.updateString(2, "*" + rs.getString(2));
       }
       stmt.close();

which raises an exception “Invalid operation for read only resultset”. Is there a way to return this cursor as something which can be updated and posted back to the db from Java? I am using Oracle 10g.

Thanks, Rob

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:24:48+00:00Added an answer on May 12, 2026 at 5:24 pm

    The problem is that when you are specifying CONCUR_UPDATABLE, that applies to the ResultSet of the function call itself — if there was one, which there isn’t. The ResultSet object that you are getting via getObject() isn’t the ResultSet of the CallableStatement, so it is by default not updatable.

    My first thought was that adding FOR UPDATE to the query in the function might make the ResultSet updatable, but no luck.

    I can’t see any way to communicate to JDBC that the result set should be updatable in this case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following javascript: function foo(selectControl) { ... } and the following html: <select
Given the following code snippet: $i= 11; function get_num() { global $i; return (--$i
On Pavel's page is the following function: CREATE OR REPLACE FUNCTION makedate(year int, dayofyear
Given the following skeleton pl/pgsql function, how can I make it return true if
Given the following code example from MSDN: private void GetPixel_Example(PaintEventArgs e) { // Create
Given the following function: def foo(a, b, c): pass How would one obtain a
Given the following code: function Person(firstName, lastName) { this.FirstName = firstName; this.LastName = lastName;
Given the following HTML and function: <input type=text onfocus=TextBoxFocus() id=txtName /> . function TextBoxFocus()
Given the following two objects: function newDoodle() { var Doodle = { /* Variables
I'm having some trouble with the following function. It is supposed to be given

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.