Re: Call Oracle Stored Procedure from Java with less arguments
- From: Joe Weinstein <joeNOSPAM@xxxxxxx>
- Date: Fri, 23 Dec 2005 07:58:36 -0800
Christian Schmidbauer wrote:
Hello!
I have a Oracle stored procedure which accepts e. g. 7 parameters which describe the columns being updated in the database. Simplified it looks like that:
PROCEDURE modify( nr IN OUT NUMBER, name IN CHAR, address IN CHAR, city IN CHAR, birthday IN DATE, errfield IN OUT CHAR, iret IN OUT NUMBER );
Now I intend to update only the "address". The other data doesn't change and shouldn't be updated.
Lines in Java: ------------------------------------------------------------- OracleCallableStatement cstmt = (OracleCallableStatement) _connection.prepareCall ("{call modify(?, ?, ?, ?, ?, ?, ?)}"); cstmt.registerOutParameter(1, OracleTypes.NUMBER); cstmt.registerOutParameter(6, OracleTypes.CHAR); cstmt.registerOutParameter(7, OracleTypes.NUMBER);
cstmt.setInt(1, 10); // nr cstmt.setString(3, "New Street 1"); // address -------------------------------------------------------------
I mustn't set the other parameters because every parameter which is set updates the corresponding value in the database.
But: The result from the program is: --> No value specified for parameter 2
When I'm doing a "cstmt.setNull(...)" with the missing parameters the database values are going to be deleted.
Does anybody know how to bypass this problem?
Thanks in advance, Christian
Yes. Rewrite the procedure to understand that null values of parameters mean not to change the relevant column values. Java can't help you get around the semantics of your procedure. HTH, Joe Weinstein at BEA Systems
.
- References:
- Call Oracle Stored Procedure from Java with less arguments
- From: Christian Schmidbauer
- Call Oracle Stored Procedure from Java with less arguments
- Prev by Date: Call Oracle Stored Procedure from Java with less arguments
- Next by Date: How to write narray Tree? example pls
- Previous by thread: Call Oracle Stored Procedure from Java with less arguments
- Next by thread: How to write narray Tree? example pls
- Index(es):
Relevant Pages
|
|