Solved

Inserting Values in Oracle CLOB field

Posted on 2011-02-28
7
476 Views
Last Modified: 2012-08-14
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
Comment
Question by:AnandSahoo
  • 3
  • 2
  • 2
7 Comments
 
LVL 73

Expert Comment

by:sdstuber
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?
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 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.
0
 

Author Comment

by:AnandSahoo
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.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 73

Expert Comment

by:sdstuber
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?
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35007163
>>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
 

Author Comment

by:AnandSahoo
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

0
 

Author Closing Comment

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

Thanks a ton
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now