concatenate rows of Clob with plsql

Posted by david K on Stack Overflow See other posts from Stack Overflow or by david K
Published on 2010-06-07T13:21:37Z Indexed on 2010/06/07 13:22 UTC
Read the original article Hit count: 594

Filed under:
|
|

Hi,

late considere i conider if got a table who got an Id and a clob content like:

create table v_EXAMPLE_L ( nip number, xmlcontent clob );

we insert our data:

Insert into V_EXAMPLE_L (NIP,XMLCONTENT) values (17852,'delta548484646846484'); Insert into V_EXAMPLE_L (NIP,XMLCONTENT) values (17852,'omega545648468484'); Insert into V_EXAMPLE_L (NIP,XMLCONTENT) values (17852, 'gamma54564846qsdqsdqsdqsd8484');

i'm trying do do a function that concatenate the rows of the clob that gone be the result of a select , i mean without having to give multiple parameter about the name of table or such , i should only give here the column that contain the clobs , and she should handle the rest!.

CREATE OR REPLACE function assemble_clob(q varchar2)
return clob
is
v_clob clob;
tmp_lob clob;   
hold VARCHAR2(4000); 
--cursor c2 is  select xmlcontent from V_EXAMPLE_L where id=17852 
  cur sys_refcursor;  
  begin  

  OPEN cur FOR q;
    LOOP
    FETCH cur INTO tmp_lob;
    EXIT WHEN cur%NOTFOUND;
      --v_clob := v_clob ||  XMLTYPE.getClobVal(tmp_lob.xmlcontent); 
        v_clob := v_clob ||  tmp_lob;

    END LOOP;
   return (v_clob);
   --return   (dbms_xmlquery.getXml( dbms_xmlquery.set_context("Select 1 from dual"))   )
 end assemble_clob;

the function is broken ... (if anybody could give me a help, thanks a lot, and i'm noob in sql so ....).

and thanks

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle