'I am trying to read a value from oracle anonymous block using JdbcTemplate

I am trying to read a value from oracle anonymous block using JdbcTemplate. Here is my java code:

getJdbcTemplate().queryForObject(sql, Boolean.class);

And here is the sql:

DECLARE
    CRS                SYS_REFCURSOR;

BEGIN

    OPEN CRS FOR SELECT CASE
                            WHEN
                                      1 > 0
                                THEN 1
                            ELSE 0
                            END
                 FROM DUAL;
END;

I am receiving this error:

 SQL state [99999]; error code [17166]; Cannot perform fetch on a PLSQL statement: next; nested exception is java.sql.SQLException: Cannot perform fetch on a PLSQL statement: next


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source