0
我想從我的ADF應用程序調用SQL過程。缺少索引:: 2
我在我的AppModule下面的代碼:
public void callProcedureSimulateFromDB(String idCategoria) {
CallableStatement cs = null;
System.out.println("categoria-> " + idCategoria);
try {
cs = getDBTransaction().createCallableStatement("begin ? := SPSIMULATE(?); end;", 0);
cs.setString(2, idCategoria);
cs.execute();
} catch (SQLException e) {
throw new JboException(e);
} finally {
if (cs != null) {
try {
cs.close();
}catch (SQLException e) {}
}
}
}
這是我支持bean中,在那裏我打電話前面的方法:
public String simulate() {
String categoria = catIdId.getValue().toString();
if (categoria != null && !categoria.isEmpty()) {
FacesContext facesContext = FacesContext.getCurrentInstance();
Application app = facesContext.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesContext.getELContext();
ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{bindings}", Object.class);
oracle.binding.BindingContainer binding = (oracle.binding.BindingContainer)valueExp.getValue(elContext);
OperationBinding operationBinding = binding.getOperationBinding("callProcedureSimulateFromDB");
// Set the Input parameters to the operation bindings as below
operationBinding.getParamsMap().put("idCategoria", categoria);
// Invoke the Application module method
operationBinding.execute();
// Get the result from operation bindings
//Object obj = operationBinding.getResult();
//System.out.println("obj ----> " + obj);
}
//ADFContext.object.applicationModule.myAMMethod() ;
//chamar funçao da DB
p55.hide();
return null;
}
我得到以下錯誤:
我在做什麼錯?我已經嘗試更改de callable語句和cs.setString()
中的數字。但是,問題保持不變。
編輯: 做一些改變的代碼後,我測試中的AppModule並得到了以下錯誤:
(oracle.jbo.JboException) JBO-29000: Unexpected exception caught: java.sql.SQLException, msg=ORA-06550: line 1, column 7:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
(begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
continue close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe purge
The symbol "<an identifier>" was substituted for "=" to continue.
無論如何不工作,但錯誤更改http://puu.sh/gyrft/db45c05976.png – SaintLike 2015-03-13 12:54:34
您是從BC測試者測試嗎? – 2015-03-13 12:58:33
我不是,但我得到了同樣的錯誤,但更長的描述 – SaintLike 2015-03-13 13:57:50