Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Inserting Values in Oracle CLOB field

Posted on 2011-02-28
Medium Priority
Last Modified: 2012-08-14

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.
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.
Question by:AnandSahoo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
LVL 74

Expert Comment

ID: 34998998
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?
LVL 77

Accepted Solution

slightwv (䄆 Netminder) earned 2000 total points
ID: 34999048
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.

Author Comment

ID: 35006276
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.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 74

Expert Comment

ID: 35006982
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?
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35007163
>>Will the above query work  for that also.


If you are using pl/sql code you might look into dbms_lob.writeappend but for straight SQL, the above should work.

Author Comment

ID: 35007453
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


Author Closing Comment

ID: 35121784
I am able to get a direction to work wih.

Thanks a ton

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question