• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 487
  • Last Modified:

Inserting Values in Oracle CLOB field

Hi,

I have one oracle table where one of the field (Column value) datatype is CLOB.
When I query on th etable by select command taking one row as example the field vaule shows as below.
"jholling001
vjoshi004
schauhan009"
These are nothing but the user names.
I want to add one more username, for example 'asahoo001' to the existing list.

Can you please help me with teh insert query syntax.
0
AnandSahoo
Asked:
AnandSahoo
  • 3
  • 2
  • 2
1 Solution
 
sdstuberCommented:
are you looking to modify the data in the table?

or just select the clob and append the new name without actually modifying the underyling data?
0
 
slightwv (䄆 Netminder) Commented:
What database version are you using?
In newer versions just concatenate it:

update table set clob_col = clob_col || chr(13) || chr(10) || 'newusername' where ...

the chr(13) and chr(10) addes the CR-LF to the clob that looks like yours has.
0
 
AnandSahooAuthor Commented:
I want to add this new name without changing the existing ones.
In the above example, 3 names are there already.Want to add the 4th one. So total I wil have 4 names after inserting.
In few scenario's I may have more names (5,6,7,8) and I want to add one more. Will the above query work  for that also.
We are using oracle 10g.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
sdstuberCommented:
sorry, I didn't ask that well  I guess

do you want to modify the table?
or simply return 4 names, 3 from the table plus 1 more?


in other words,  is this a read or a write operation?
0
 
slightwv (䄆 Netminder) Commented:
>>Will the above query work  for that also.

Yes.

If you are using pl/sql code you might look into dbms_lob.writeappend but for straight SQL, the above should work.
0
 
AnandSahooAuthor Commented:
Dear sdstuber
This is a write operation. So wondering if teh update query will replace teh existing ones. I dont have staging environment for this to try.

Dear slightwv,
will try with just one record and confirm u back soon

0
 
AnandSahooAuthor Commented:
I am able to get a direction to work wih.

Thanks a ton
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now