简体   繁体   中英

SimpleJdbcCall: Reading a CLOB returned from stored procedure

I have DAO function that calls DB procedure using SimpleJdbcCall. However i am unable to read the CLOB data returned from stored procedure. When i try to do a .toString() on the returned CLOB value ( result.get("OUT_RTN_XML") ), I just get this in the string : oracle.sql.CLOB@f762282a

Below is the code snippet.

SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(jdbcTemplate);
    simpleJdbcCall.withSchemaName(_properties.getPropertyValue("schemaName"));
    simpleJdbcCall.withCatalogName(_properties.getPropertyValue("packageName"));
    simpleJdbcCall.withProcedureName(_properties.getPropertyValue("procedureName"));

    try {
        SqlParameterSource sqlParameterSource = new MapSqlParameterSource()
                .addValue("P_INPUT", input);

        Map<String, Object> result = simpleJdbcCall.execute(sqlParameterSource);
        if(result.get("OUT_RTN_XML") != null) {
            rtnXml = result.get("OUT_RTN_XML").toString();
        }

    } catch(Exception e) {
        e.printStackTrace();
    }
if(result.get("OUT_RTN_XML") != null) {                                                 
    Clob clob = (Clob) out.get("OUT_RTN_XML");     
    long len = clob.length();             
    rtnXml = clob.getSubString(1, (int) len);       
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM