The segment below calls a custom function with 1 input parameter of type Varchar and returns a Varchar :
OAApplicationModule oam = pageContext.getApplicationModule(webBean);
String sql = "BEGIN :1 := xx_custom_pkg.call_custom_function (:2); END;";
OracleCallableStatement cs =
(OracleCallableStatement)oam.getOADBTransaction().createCallableStatement(sql,2);
try {
//Register your function output...
cs.registerOutParameter(1, Types.VARCHAR, 0, 2000);
//Your input parameter below...
cs.setString(2, LinesRow.getAttribute("ReportLineId").toString());
cs.execute();
String p_res = cs.getString(1);
cs.close();
}
catch (Exception ex) {
pageContext.writeDiagnostics(this,
"Error:" + ex.toString(),
OAFwkConstants.PROCEDURE);
}
OAApplicationModule oam = pageContext.getApplicationModule(webBean);
String sql = "BEGIN :1 := xx_custom_pkg.call_custom_function (:2); END;";
OracleCallableStatement cs =
(OracleCallableStatement)oam.getOADBTransaction().createCallableStatement(sql,2);
try {
//Register your function output...
cs.registerOutParameter(1, Types.VARCHAR, 0, 2000);
//Your input parameter below...
cs.setString(2, LinesRow.getAttribute("ReportLineId").toString());
cs.execute();
String p_res = cs.getString(1);
cs.close();
}
catch (Exception ex) {
pageContext.writeDiagnostics(this,
"Error:" + ex.toString(),
OAFwkConstants.PROCEDURE);
}
No comments:
Post a Comment