How to insert base64 encoded img src attribute into table in Oracle and then display it on the page in Oracle apex

天涯浪子 提交于 2020-01-06 05:27:09

问题


My requirement is to insert img src values into table and then display in on the apex page. How can I do that?

I have created a function which inserts the img src into CLOB column But incase the length exceeds 32000 it doesnt insert it to the CLOB column


回答1:


The fact that your data is getting truncated at 32000 characters (probably actually 32767) means you have some intermediate VARCHAR2. Other than that, there's not enough information here.

Once you get your base64 encoded data, to display it on an Apex page, the easiest way to do that is with a PL/SQL region and the htp package. None of the native htp functions support CLOBs, so you will have to output it in chunks. Something like this:

i:= 1;
loop
    l_chunk := dbms_lob.substr( l_b64_clob, l_chunk_size, i );
    exit when l_chunk is null;
    htp.prn( l_chunk );
    i := i + l_chunk_size;
end loop;

I suggest you write a reusable procedure to do this.



来源:https://stackoverflow.com/questions/52904376/how-to-insert-base64-encoded-img-src-attribute-into-table-in-oracle-and-then-dis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!