Calling pl/sql function with mybatis 3

后端 未结 2 600
感动是毒
感动是毒 2020-12-30 14:51

I have a function that returns a boolean value in pl/sql. I have tried to get directly that boolean value without success, so now I\'m trying to convert it to string (I do

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-30 15:25

    I wrote parameterType & Map example. It works on my test data.

    XML:

    
        declare
            v_bool BOOLEAN := TRUE;
        begin
            v_bool := PACKNAME.STF$IS_PUBLIC_OBJECT(#{id});
            #{result,jdbcType=VARCHAR,mode=OUT} := CASE WHEN v_bool THEN 'TRUE' ELSE 'FALSE' END;
        end;
    
    

    Mapper:

    public interface PLSQLMapper {
        public void isPublicObject(Map parameterMap);
    }
    

    Main:

    PLSQLMapper mapper = session.getMapper(PLSQLMapper.class);
    
    Map parameterMap = new HashMap();
    parameterMap.put("id", 1);
    mapper.isPublicObject(parameterMap);
    System.out.println("result: " + parameterMap.get("result"));
    

提交回复
热议问题