CallableStatement cstmt = (CallableStatement) pstmt; Class cl = Class.forName("oracle.jdbc.OracleTypes");
CallableStatement callableStmt = (CallableStatement) pstmt;
  public static boolean oci_bind_by_name(Env env,                                         @NotNull OracleStatement stmt,                                         @NotNull String placeholderName,                                         Value variable,                                         @Optional("0") int maxLength,                                         @Optional("0") int type)  {    try {      if (placeholderName == null) {        return false;      }      if (!placeholderName.startsWith(":")) {        placeholderName = ":" + placeholderName;      }      if (placeholderName.length() < 2) {        return false;      }      Integer index = (Integer) stmt.getBindingVariable(placeholderName);      int i = index.intValue();      PreparedStatement pstmt = stmt.getPreparedStatement();      CallableStatement cstmt = (CallableStatement) pstmt;      Class cl = Class.forName("oracle.jdbc.OracleTypes");      if (type == SQLT_RSET) {        int cursorType = cl.getDeclaredField("CURSOR").getInt(null);        cstmt.registerOutParameter(i, cursorType);        // Set the cursor's underlying prepared statement        // to be executed (see php/4404).        OracleStatement cursor = (OracleStatement) variable.toJavaObject();        cursor.setPreparedStatement(cstmt);      } else if ((type == OCI_B_CLOB) || (type == SQLT_CLOB)) {        // stmt.putByNameVariable(placeholderName, (Value) variable);        int clobType = cl.getDeclaredField("CLOB").getInt(null);        cstmt.registerOutParameter(i, clobType);        stmt.setOutParameter(variable);      } else {        // XXX: Check the spec. if there is a case where the        // variable would not be initialized yet        // stmt.putByNameVariable(placeholderName, variable);        pstmt.setString(i, variable.toString());      }      return true;    } catch (Exception ex) {      log.log(Level.FINE, ex.toString(), ex);      try {        stmt.resetBindingVariables();        stmt.resetByNameVariables();      } catch (Exception ex2) {        log.log(Level.FINE, ex2.toString(), ex2);      }    }    return false;  }