Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> problem updating a resultset in jdbc when returning cursor from function
Hi,
So, I'm spent a lot of time looking around this group but haven't been
able to solve my problem yet. Basically, I'm trying to figure out how
I can achieve an updatable recordset in Java which has been returned
from a oracle function via a cursor.
When I try to move to an insert row I keep getting an exception saying my resultSet is read only. I'm wondering if it has something to do with casting to a ResultSet. Does it automatically become read-only?
Everything works fine if my query is not a function call but is a
select query.
Any help would be much appreciated! Thx. RAchel
Here's the Java:
String query = "begin ? := " + INSERT_OR_UPDATE_ENTITY_PROC + " (?); end;";
stmt = conn.prepareCall(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
stmt.registerOutParameter( 1, OracleTypes.CURSOR); stmt.setBytes(2, m_user.getId().toByteArray()); stmt.execute(); rset = (ResultSet)stmt.getObject(1); rset.moveToInsertRow();
Here's the SQL:
FUNCTION InsertOrUpdateEntity(vId IN RAW) RETURN cursorType
IS
l_cursor cursorType;
BEGIN
OPEN l_cursor FOR SELECT entityId, entityCd
FROM ENTITY WHERE entityId = vId;
RETURN l_CURSOR;
END;
Received on Wed Sep 25 2002 - 15:15:14 CDT
![]() |
![]() |