Display CLOB in Jasper

前端 未结 2 1553
清歌不尽
清歌不尽 2021-01-26 00:35

My query in Jasper got CLOB data, but I\'m not able to display it in my report, I even tried some of the solution that I found in this forum.

Both of these were not work

相关标签:
2条回答
  • 2021-01-26 01:23

    Done. I found some trick to solve this unanswered problem. As we know Varchar2 only support 4000 of characters. So i came up with a trick to cut by part of my CLOB data in query like this:

    select DBMS_LOB.SUBSTR(clob_field, 4000, 1) as clob_data_1 
    select DBMS_LOB.SUBSTR(clob_field, 2000, 4001) as clob_data_2
    from table
    

    as you can see, i separately put my CLOB data in clob_data_1 and clob_data_2 so it still act as a String. In my case, i just used 6000 of characters. DBMS_LOB.SUBSTR is a oracle function to substring data.

    In my report, i can simply combine this column just like this:

    $F{clob_data_1}+$F{clob_data_2}
    

    I hope with this solution, it can help some people that have similar problem like me.

    0 讨论(0)
  • 2021-01-26 01:30

    Try to make a String obiect from the CLOB either by appending "" or by calling String.valueOf()

    0 讨论(0)
提交回复
热议问题