Insert xml into clob column

we have this table with few varchar and one clob type column.we save fairly a large xml with namespaces and attribute driven xml elements.I need some test data created.I just want to know the way to insert a single row in the table, specially how to insert a complex xml say 8k chars in the clob column.with one insert in place i can apply for loop to get more rows inserted.
DevildibAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
I create a pl/sql block
declare 
    myclob clob;
begin
    myclob := '<root>';
    myclob := myclob || '<node1>some test data</node1>';
    myclob := myclob || '</root>';

    insert into mytable values(myclob);
end;
/

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DevildibAuthor Commented:
I will try your solution
0
slightwv (䄆 Netminder) Commented:
Are you sure that XML is safe to post on a public site?

I create dummy XML the way I posted all the time.

Depending on your text editor it is really easy with some global search and replace.  Assuming you can search for the begin and end of line like in a vi style editor.

When I create the pl/sql block, I also indent the myclob := pieces to maintain the indentation appearance.

...
 myclob := myclob || '<node1>';
              myclob := myclob || '<node2>0</node2>';
 myclob := myclob || '</node1>';
...

It would make the CLOB bigger but you could do it with spaces in the lob itself as well.
...
 myclob := myclob || '<node1>';
 myclob := myclob || '             <node2>0</node2>';
 myclob := myclob || '</node1>';
...
0
DevildibAuthor Commented:
Pls delete
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.