oracle - Unable to invoke Stored Procedure using Spring JDBC -
oracle - Unable to invoke Stored Procedure using Spring JDBC -
we unable phone call stored procedure using spring jdbc. below code snippet.
procedure signature procedure get_cash_details ( p_org_id in varchar2, p_receipt_number in varchar2, p_result_type in varchar2, x_cash_detail out cash_detail_rec, x_error_msg out varchar2 ); cash_detail_rec of type strut returning record type , 2 arrays
java code :
public void callstoredprocedure(string receiptnumber, string orgid, string type) { cashdetailsprocedure procedure = new cashdetailsprocedure(jdbctemplate); procedure.execute(); } public class cashdetailsprocedure extends storedprocedure { @autowired jdbctemplate jdbctemplate; public cashdetailsprocedure(jdbctemplate jdbctemplate) { super(jdbctemplate, "bpel_llpocwrapper.xx_ar_cashrcpt_rcv_pkg$get_ca "); declareparameter(new sqlparameter("p_org_id", oracletypes.varchar)); declareparameter(new sqlparameter("p_receipt_number", types.varchar)); declareparameter(new sqlparameter("p_result_type", types.varchar)); declareparameter(new sqloutparameter("x_cash_detail", oracletypes.struct, "xx_ar_cashrcpt_rx3372075x1x4", new receipthandler())); declareparameter(new sqloutparameter("x_error_msg", oracletypes.varchar)); compile(); } public map<string, object> execute() { map<string, object> inparams = new hashmap<string, object>(); inparams.put("p_org_id", "204"); inparams.put("p_receipt_number", "89067"); inparams.put("p_result_type", "summary"); map output = execute(inparams); homecoming output; } }
error message :
callablestatementcallback; uncategorized sqlexception sql [{call bpel_llpocwrapper.xx_ar_cashrcpt_rcv_pkg$get_ca (?, ?, ?, ?, ?)}]; sql state [null]; error code [17090]; operation not allowed: ordinal binding , named binding cannot combined!; nested exception java.sql.sqlexception: operation not allowed: ordinal binding , named binding cannot combined!
you can define simple query as
string query = "select * yourstoredprocedurename(?,?,?);"
and while calling using jdbctemplate can utilize 2 approach mapper or without mapper. 1> jdbctemplate.queryforobject(query,yourmapper, param1, param2, param3);
2>
list<map<string, object>> rows = jdbctemplate.queryforlist(query, param1, param2, param3); (map<string, object> row : rows) { system.out.println(row.get("firstname")); }
the sec method gives rows there can results each result column.
oracle stored-procedures plsql spring-jdbc complextype
Comments
Post a Comment