在 :: 2 处缺少索引

Missing index at:: 2

我正在尝试从我的 ADF 应用程序调用 SQL 过程。

我的 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.

如果 SPSIMULATE 是存储过程(而不是存储函数),您可以尝试更改此行:

 cs = getDBTransaction().createCallableStatement("begin ? := SPSIMULATE(?); end;", 0);

  cs = getDBTransaction().createCallableStatement("{call SPSIMULATE(?)}", 0);

并确保先从 BC Tester 测试您的过程,然后再从支持 bean 调用它。步子越小越快。