Problems encountered in fixing bugs yesterday
The operation is to call procedures with Java program, and the database is Oracle
However, after Java calls this save, the following error is reported in the console during execution:
java.lang.Exception: java.sql.SQLException: ORA-06553: PLS-306: wrong number or types of arguments in call to ‘SP_ ACT_ DAYACCOUNTAMOUNT’
There is still no good way to search the results on the Internet. Finally, the problem was solved by colleagues
The reason is that there is a problem in passing parameters. Since this Oracle is transplanted from DB2, an out parameter is added to the original one for return, so the number of parameters is changed from 8 to 9. More vcur out sys in parameter_ Refcursor
The final solution is:
Therefore, the Java program should be changed accordingly
..............
String procedure = "call sp_act_dayaccountamount(?,?,?,?,?,?,?,?,?)"; //Add one more parameter
cstmt = con.prepareCall(procedure);
..............
..............
..............
cstmt.setLong(7, vo.getLedgerID());
cstmt.setLong(8, vo.getCurrencyID());
cstmt.registerOutParameter(9, OracleTypes.CURSOR); //add
cstmt.execute();
//rs = cstmt.getResultSet();
rs = (ResultSet)cstmt.getObject(9); //add
..............
Because the database operation of this program uses hibernate, you need to add the above sentences, such as comments. And you need to add one more when you transfer parameters?, Otherwise, “invalid column index” will be reported
Similar Posts:
- Database Insert error: ora-06550 [How to Solve]
- Sometimes ora-04062 error occurs when database is running stored procedure
- [Solved] Java Call Error: java.lang.IllegalArgumentException: wrong number of arguments
- ORA-12518 TNSlistener could not hand off client connection [Solved]
- Oracle: db_12.2.0.1.0_Linux-x86-64: dbca Customized mode:ORA-07202: sltln: invalid parameter to sltln.
- [Solved] Mybatis Mapping Error: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘id’ in ‘class java.lang.String
- [How to Solve] for the right syntax to use near ”X”
- [Solved] ORA-27154: post/wait create failed ORA-27300 ORA-27301 ORA-27302
- Database Start Error after Recovery: ORA-01092: ORA-30012: undo tablespace
- oracle ORA-39700: database must be opened with UPGRADE option