1. admin
  2. ADF Code Snippets
  3. Tuesday, March 27 2018, 06:34 PM
  4.  Subscribe via email
import oracle.jbo.server.ApplicationModuleImpl;
import oracle.jbo.server.ViewLinkImpl;
import oracle.jbo.server.ViewObjectImpl;

import java.sql.CallableStatement;
import java.sql.SQLException;

import java.sql.Types;

import oracle.jbo.JboException;


    protected Object callStoredFunction(int sqlReturnType, String stmt, Object[] bindVars) {
CallableStatement cst = null;
try {
//Creating sql statement
cst = this.getDBTransaction().createCallableStatement("begin ? := " + stmt + ";end;", 0);
//Register dataType for return value
cst.registerOutParameter(1, sqlReturnType);
//Pass input parameters value
if (bindVars != null) {
for (int z = 0; z < bindVars.length; z++) {
cst.setObject(z + 2, bindVars[z]);
}
}
cst.executeUpdate();
//Finally get returned value
return cst.getObject(1);
} catch (SQLException e) {
throw new JboException(e.getMessage());
} finally {
if (cst != null) {
try {
cst.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
Rate this post:


There are no replies made for this post yet.
However, you are not allowed to reply to this post.