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
I wrote parameterType
& Map
example. It works on my test data.
XML:
<update id="isPublicObject" parameterType="map" statementType="CALLABLE">
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;
</update>
Mapper:
public interface PLSQLMapper {
public void isPublicObject(Map<String, Object> parameterMap);
}
Main:
PLSQLMapper mapper = session.getMapper(PLSQLMapper.class);
Map<String, Object> parameterMap = new HashMap<String, Object>();
parameterMap.put("id", 1);
mapper.isPublicObject(parameterMap);
System.out.println("result: " + parameterMap.get("result"));
The #{} syntax can only be used for parameter substitution. It is not a variable that gets set after the execution of the PL/SQL. It can only be set before the prepared statement is built.
One way of going forward would be to use stored procedure and use an OUT param to get your result out.