PL / SQL Array对CLOB [英] PL/SQL Array to CLOB
问题描述
读音字使用的是Oracle 9i中。
i m using Oracle 9i.
我米从游标中读取数据到一个数组:
I m fetching data from a cursor into an array :
FETCH contract_cur
BULK COLLECT INTO l_contract ;
但现在我想转换这个* l_contract *成CLOB变量* l_clob *
But now i want to "convert" this *l_contract* into a CLOB variable *l_clob*
有没有一种简单的方法来做到这一点?
Is there an easy way to do that?
或者否则,我怎么convertthe从SELECT语句行成一个单一的CLOB变量?
Or otherwise, how do i convertthe rows from a SELECT statement into one single CLOB Variable ?
感谢
编辑:我忘了,更不用说其ROWTYPE%的数组,而不仅仅是一列
EDIT : i forgot to mention its an array of %ROWTYPE, not just one column.
推荐答案
什么丑陋的事情。
是不是所有的字符数据,或者你在有数字和/或日期/时间值有太多?如果是这样,你要当你将它们转换为字符串,用于这些数据类型的格式。
Is it all character data, or do you have numeric and/or date/time values in there too ? If so what format do you want to use for those datatypes when you convert them to strings.
您可能还需要考虑字段和记录分隔符。
You also may need to think about field and record delimiters.
你有没有考虑XML?
declare
v_clob clob;
v_xml xmltype;
begin
select xmlagg(XMLELEMENT("test",xmlforest(id,val)))
into v_xml
from test;
select v_xml.getclobval
into v_clob
from dual;
dbms_output.put_line(v_clob);
end;
/
这篇关于PL / SQL Array对CLOB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!