我正在尝试调用这样的函数:
PCK_BEE.FUN_FOO(A IN VARCHAR2, B OUT T_CURSOR) RETURN VARCHAR2;
--
TYPE T_CURSOR IS REF CURSOR;
--
TYPE R_DEP IS RECORD (P_CODE VARCHAR2(3), P_DESC VARCHAR2(30));
在MyBatis上我创建了一个Object:
public class LovPrc {
private List<ProcedureTypeLov> lov;
private String error;
// Getters and Setters
}
ProcedureTypeLov:
public class ProcedureTypeLov {
private String code;
private String description;
// Getters and Setters
}
映射器:
<select id="lovDep" resultType="LovPrc" parameterType="map"
statementType="CALLABLE">
{ #{error, mode=OUT, jdbcType=VARCHAR} = call
PCK_BEE.FUN_FOO(#{A, mode=IN,
#{lov, jdbcType=CURSOR,
mode=OUT, resultMap=LovPrc, javaType=java.sql.ResultSet})}
</select>
POJO正在返回该对象,但我将其作为null。
如何调用此类函数并将其返回到POJO上?无法将两个参数更改为PROCEDURE作为OUT
答案 0 :(得分:1)
处理这个问题,这就是我的工作方式:
<select id="lovDep" parameterType="LovPrc" statementType="CALLABLE">
{ #{error,jdbcType=VARCHAR,mode=OUT} = call PCK_BEE.FUN_FOO(#{A, mode=IN, jdbcType=VARCHAR},
#{lov, jdbcType=CURSOR, resultMap=MapLov, mode=OUT})}
</select>
<resultMap id="MapLov" type="ProcedureTypeLov">
<result column="A (name of the column returned by CURSOR)" property="a"/>
</resultMap>
LovPrc作为参数Object用于调用和out用于处理响应。