如何将base64编码的img src属性插入Oracle中的表中,然后在Oracle apex中的页面上显示它 [英] How to insert base64 encoded img src attribute into table in Oracle and then display it on the page in Oracle apex
问题描述
我的要求是将img src值插入表中,然后在顶点页面上显示. 我该怎么办?
My requirement is to insert img src values into table and then display in on the apex page. How can I do that?
我创建了一个将img src插入CLOB列的函数 但是,如果长度超过32000,则不会将其插入到CLOB列中
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
推荐答案
您的数据被截断为32000个字符(可能实际上是32767)的事实意味着您有一些中间的VARCHAR2
.除此之外,这里没有足够的信息.
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.
一旦获得base64编码的数据,就可以在Apex页面上显示该数据,最简单的方法是使用PL/SQL区域和htp
包.本机htp
函数均不支持CLOB,因此您必须将其分块输出.像这样:
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.
这篇关于如何将base64编码的img src属性插入Oracle中的表中,然后在Oracle apex中的页面上显示它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!