ORA-06550: PLS-00103: Mybatis TypeHandler 遇到符号 ""

ORA-06550: PLS-00103: Encountered the symbol "" with mybatis TypeHandler

我正在使用 TypehandlerList<Dep> 映射到...的 oracle 数组这是处理程序中的 setPArameter 方法:

    public void setParameter(PreparedStatement ps, int i, List<Dep> parameter, JdbcType jdbcType)
            throws SQLException {
        Connection connection = ps.getConnection();
//      StructDescriptor structDescriptor = StructDescriptor.createDescriptor("MEMS_ARR", connection);
        Struct[] structs = null;
        if(parameter != null && parameter.size() >0) {
            structs = new Struct[parameter.size()];
            for (int index = 0; index < parameter.size(); index++)
            {
                Dep dep = parameter.get(index);
                Object[] params = new Object[7];
                params[0] = dep.getOrder();
                params[1] = dep.getIdTp;
                params[2] = dep.getId();
                params[3] = " ";
                params[4] = " ";
                params[5] = " ";
                params[6] = " ";
    //            STRUCT struct = new STRUCT(structDescriptor, ps.getConnection(), params);
                structs[index] = connection.createStruct("MEMS", params);
            }
    //        ArrayDescriptor desc = ArrayDescriptor.createDescriptor("MEMS_ARR", ps.getConnection());
    //        ARRAY oracleArray = new ARRAY(desc, ps.getConnection(), structs);
        }else {
            parameter = new ArrayList<DependentDTO>();
            structs= new Struct[0];
        }
        this.parameter = parameter;
        Array oracleArray = ((OracleConnection) connection).createOracleArray("MEMS_ARR", structs);
        ps.setArray(i, oracleArray);
    }

这里是 MEMS 类型:

create or replace TYPE MEMS AS OBJECT 
( MEM1          NUMBER(2,0),
  MEM2          VARCHAR2(1),
  MEM3          VARCHAR2(15),
  MEM4          VARCHAR2(60),
  MEM5          VARCHAR2(1),
  MEM6          VARCHAR2(40),
  MEM7          VARCHAR2(10)
);

这里是 xml 映射文件中使用 Typehandler 的部分:

#{nat,javaType=String,jdbcType=VARCHAR,mode=IN}, --nat
**#{deps,javaType=List,jdbcType=ARRAY,mode=IN,jdbcTypeName=MEMS_ARR,typeHandler=com.my.package.MyHandler}, --mems**
#{res,javaType=String,jdbcType=VARCHAR,mode=OUT} --res

错误日志如下:

Error querying database. Cause: java.sql.SQLException: ORA-06550: line 31, column 5: PLS-00103: Encountered the symbol "" when expecting one of the following: . ( ) , * @ % & = - + < / > at in is mod remainder not rem => <an exponent (**)> <> or != or ~= >= <= <> and or like like2 like4 likec between || indicator multiset member submultiset The symbol "(" was substituted for "" to continue. ORA-06550: line 44, column 4: PLS-00103: Encountered the symbol ";" when expecting one of the following: . ( ) , * % & = - + < / > at in is mod remainder not rem => <an exponent (**)> <> or != or ~= >= <= <> and or like like2 like4 likec between || multiset ### The error may exist in file [E:\path\to\mapper\ADao.xml] ### The error may involve my.package.ADao.mthodToCall -Inline ### The error occurred while setting parameters ### SQL: {call MY_PROC( ... , --nat?, **--mems? --res**)}

正如您在日志中看到的那样,mems 被空字符串替换或与下一个 arg res 合并......逗号不存在

另请注意,我已经在 mybatis 代码中调试并意识到映射 setParameter 方法被调用并且输入列表被正确映射到 oracle 数组......问题发生在真正的呼唤

问题实际上是我只是漏掉了前面两个参数之间的一个逗号...但是错误指向了错误的参数来查看