Search code examples
mybatisspring-mybatis

mybatis mapping multiple OUT to java object


Having problems mapping procedure params. Error:

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

Procedure:

    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> 

And i call it like this:

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

Is there something wrong with my code ?


Solution

  • To resolve this error, you should modify your procedure to declare the variable partner_code