Hello,
I am facing a reculiar issue while trying to execute a function using SimpleJdbcCall.
This is the function spec:
Code:
FUNCTION chkFootnoteSym
(
pivcCusipNo IN cusip_issues.cusip_no%TYPE,
pivcFootNoteSym IN ddr_footnotes.ftnt_symbol%TYPE,
ponumRetCode OUT NUMBER,
povcRetMsg OUT VARCHAR2
) RETURN NUMBER ;
This is the method I have written:
Code:
public Map<String, Object> chkFootnoteSym(Map<String, Object> inputObject) {
String functionName = "<Schema>.<package>.chkFootnoteSym";
Integer fnResultInt = null;
Map<String, Object> fnResult = new HashMap<String, Object>();
try {
SimpleJdbcCall sJdbcCallFunction = new SimpleJdbcCall(getDataSource())
.withoutProcedureColumnMetaDataAccess()
.withFunctionName(functionName)
.declareParameters(new SqlParameter("pivcCusipNo", Types.VARCHAR))
.declareParameters(new SqlParameter("pivcFootNoteSym", Types.VARCHAR))
.declareParameters(new SqlOutParameter("ponumRetCode", Types.INTEGER))
.declareParameters(new SqlOutParameter("povcRetMsg", Types.VARCHAR))
.declareParameters(new SqlOutParameter("RETURN", Types.INTEGER));
sJdbcCallFunction.setAccessCallParameterMetaData(false);
Map<String, Object> dataMap = new HashMap<String, Object>();
dataMap.put("pivcCusipNo", (String)inputObject.get("pivcCusipNo"));
dataMap.put("pivcFootNoteSym", (String)inputObject.get("pivcFootNoteSym"));
fnResultInt = sJdbcCallFunction.executeFunction(Integer.class, dataMap);
fnResult.put("resultCode", fnResultInt);
} catch (NullPointerException npe) {
//do something!!
} catch (UncategorizedSQLException use) {
//do something!!
}
return fnResult;
}
This is executing without any error, but the fnResultInt is null after the execution. When I am executing the function in Oracle with certain data I am getting back the result:
Code:
declare
result number;
ponumRetCode number;
povcRetMsg varchar2(100);
begin
-- Call the function
result := chkFootnoteSym('xxxxxxxxx', '*', ponumRetCode, povcRetMsg);
DBMS_OUTPUT.PUT_LINE( 'Result:' || to_char( result ) );end;
Can anybody please help me?