{"record":{"id":"18cd6a3a588b5091","repo":"mybatis/mybatis-3","slug":"error-attempting-to-get-column-columnindex-18cd6a","errorCode":null,"errorMessage":"Error attempting to get column #\" + columnIndex + \" from callable statement.  Cause: \" + e","messagePattern":"Error attempting to get column #\" \\+ columnIndex \\+ \" from callable statement\\.  Cause: \" \\+ e","errorType":"exception","errorClass":"ResultMapException","httpStatus":null,"severity":"error","filePath":"src/main/java/org/apache/ibatis/type/BaseTypeHandler.java","lineNumber":107,"sourceCode":"    }\n  }\n\n  @Override\n  public T getResult(ResultSet rs, int columnIndex) throws SQLException {\n    try {\n      return getNullableResult(rs, columnIndex);\n    } catch (Exception e) {\n      throw new ResultMapException(\"Error attempting to get column #\" + columnIndex + \" from result set.  Cause: \" + e,\n          e);\n    }\n  }\n\n  @Override\n  public T getResult(CallableStatement cs, int columnIndex) throws SQLException {\n    try {\n      return getNullableResult(cs, columnIndex);\n    } catch (Exception e) {\n      throw new ResultMapException(\n          \"Error attempting to get column #\" + columnIndex + \" from callable statement.  Cause: \" + e, e);\n    }\n  }\n\n  public abstract void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType)\n      throws SQLException;\n\n  /**\n   * Gets the nullable result.\n   *\n   * @param rs\n   *          the rs\n   * @param columnName\n   *          Column name, when configuration <code>useColumnLabel</code> is <code>false</code>\n   *\n   * @return the nullable result\n   *\n   * @throws SQLException","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/mybatis/mybatis-3/blob/008069adb1b089579b5dcba87ee591908b263274/src/main/java/org/apache/ibatis/type/BaseTypeHandler.java#L89-L125","documentation":"The CallableStatement variant of getResult: reading an OUT parameter by index from a stored procedure call failed inside getNullableResult, and BaseTypeHandler wrapped it in ResultMapException. The failing OUT parameter is identified by its 1-based position.","triggerScenarios":"A {CALL ...} statement whose declared OUT parameters do not match the parameterMapper/resultMap order; the stored procedure changed its OUT parameter types; reading mode=OUT parameters with a handler for the wrong java type.","commonSituations":"Stored procedure signatures evolving without updating the mapper's parameterMap; Oracle/SQL Server procedures returning REF CURSOR or custom types handled by the wrong handler.","solutions":["Compare the mapper's OUT parameter declarations (order and jdbcType) with the actual procedure signature","Check the Cause: 'parameter not out' means mode was declared IN, wrong type means the handler mismatches","Update the jdbcType/javaType (or explicit typeHandler) of the failing parameter to the procedure's real type"],"exampleFix":"// before\n{CALL get_user(#{id,mode=IN},#{name,mode=OUT,jdbcType=VARCHAR})}\n\n// after\n{CALL get_user(#{id,mode=IN},#{name,mode=OUT,jdbcType=NVARCHAR})} -- match real proc type","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { ... } catch (ResultMapException e) { // identifies the failing OUT param index; diff against the stored procedure signature }","preventionTips":["Keep a single source of truth for procedure signatures and regenerate mappers on change","Declare mode=OUT and explicit jdbcType on every OUT parameter","Integration-test stored-procedure mappers against a real database, not mocks"],"tags":["mybatis","stored-procedures","callablestatement","out-parameters"],"backgroundTag":null,"analyzedSha":"008069adb1b089579b5dcba87ee591908b263274","analyzedAt":"2026-08-14T13:07:10.264Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}