mybatis将多个OUT映射到java对象

时间:2017-06-13 08:03:17

标签: mybatis spring-mybatis

映射程序参数有问题。错误:

Error querying database.  Cause: java.sql.SQLException: ORA-06550: line 1, column 7:\nPLS-00201: identifier 'getAnswer' must be declared\nORA-06550: line 1, column 7:\nPL/SQL: Statement ignored\n\r\n### The error may exist in ..retrieveInfoMapper.xml\r\n### The error may involve ..retrieveInfo-Inline\r\n### The error occurred while setting parameters\r\n### SQL: { CALL getAnswer(    ?,    ?   )   }\r\n### Cause: java.sql.SQLException: ORA-06550: line 1, column 7:\nPLS-00201: identifier 'getAnswer' must be declared\nORA-06550: line 1, column 7:\nPL/SQL: Statement ignored\n\n; bad SQL grammar []; nested exception is java.sql.SQLException: ORA-06550: line 1, column 7:\nPLS-00201: identifier 'getAnswer' must be declared\nORA-06550: line 1, column 7:\nPL/SQL: Statement ignored\n

步骤:

    CREATE OR replace PROCEDURE getAnswer(request IN VARCHAR2,result OUT VARCHAR2)
IS
               a     VARCHAR2(60);
BEGIN
    SELECT a.b
    INTO   result
    FROM   ..;

END;

mybatis conf:

<mapper namespace="..InfoMapper">


    <select id="retrieveInfo" parameterType="java.util.HashMap" statementType="CALLABLE">
        { CALL getAnswer(
            #{request, javaType=String, jdbcType=VARCHAR, mode=IN},
            #{result, javaType=String, jdbcType=VARCHAR, mode=OUT}
        )
        }
    </select>

</mapper> 

我称之为:

        HashMap<String,Object> params = new HashMap<>();
        params.put("request", "test");
        params.put("result", null);
        infoMapper.retrieveInfo(params);

我的代码有问题吗?

1 个答案:

答案 0 :(得分:0)

要解决此错误,您应修改过程以声明变量partner_code