1

I'm using the following code for passing java array to stored procedure

<select id="abcd" parameterType="java.util.Map" statementType="CALLABLE">
    {call PKG_xyz.PR_cbcd(
        #{p_array,jdbcType=ARRAY,typeHandler=org.apache.ibatis.type.ArrayTypeHandler,mode=IN},
        #{p_ids,jdbcType=INTEGER,mode=IN},
        #{p_comments,jdbcType=VARCHAR,mode=IN},
        #{p_return_code,jdbcType=INTEGER,mode=OUT},
        #{p_msg_out,jdbcType=VARCHAR,mode=OUT}   
    )}
</select>

here, p_array is my java array. But i'm getting the following error --> "Error setting null for parameter #1 with JdbcType ARRAY . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: Invalid column type: sqlType=2003"

Could somebody please help....

Thanks in advance...

1 Answer 1

2

Try to write your custom TypeHandler like

public class ArrayTypeHandler implements TypeHandler<YourArrayObject[]>{
}

Override this method below to set oracle.sql.ARRAY to PreparedStatement:-

public void setParameter(PreparedStatement ps, int i,
            YourArrayObject[] parameter, JdbcType jdbcType) throws SQLException {}

This url might help you do the same:- How to Pass Java List of Objects to Oracle Stored Procedure Using MyBatis?

Similarly, override getResult() method to get OUT array paramter

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.