Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8887727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:52:53+00:00 2026-06-14T21:52:53+00:00

I have a table in Oracle database with field with data type CLOB .

  • 0

I have a table in Oracle database with field with data type CLOB. The name of field is XMLString. I am storing XML string which is 10,000 characters long for each record. I have more than 100, 000 of records in this table.

I need to update segment of the XML string on each record at specific place. For example I need to update each record at 14th position with some string like “My New text”. This replacement text is 11 characters long. So this simply means it will replace 11 characers starting from 14th character.

I tried to use DBMS_LOB.FRAGMENT_REPLACE, but it is not exactly what I wanted.

Is there any simple command like

Replace(XMLString, 14, ‘My New text’) 

so that I can do something like below?

UPDATE MYTABLE 
SET MyClobField = Replace(MyClobField, 14, 'My New text')
WHERE MyTableID>5000

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:52:55+00:00Added an answer on June 14, 2026 at 9:52 pm

    SQL using

    UPDATE MYTABLE 
    SET MyClobField = substr(MyClobField, 1, 10) || to_clob('MyNewtext')||substr(MyClobField, 10+length('MyNewtext')+1)
    where..
    

    just change the 2 occurrences of "10" to the offset.

    or in PL/SQL like this using the DBMS_LOB.WRITE API (this is faster than the above)

    SQL> create table foo(c clob);
    
    Table created.
    
    SQL> insert into foo values ( 'this is a test string ' || rpad('x', 20, 'x'));
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> select * from foo;
    
    C
    --------------------------------------------------------------------------------
    this is a test string xxxxxxxxxxxxxxxxxxxx
    
    SQL> declare
      2    v_lob clob;
      3  begin
      4
      5    for r_lob in (select c
      6                    from foo
      7                    for update)
      8    loop
      9      dbms_lob.write(r_lob.c, 6, 16, 'phrase'); -- ie write at offset 16, 6 bytes
     10    end loop;
     11  end;
     12  /
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from foo;
    
    C
    --------------------------------------------------------------------------------
    this is a test phrase xxxxxxxxxxxxxxxxxxxx
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a table in a oracle database in which one of the field
I have a students table in my Oracle database which has a field called
we have a table in an Oracle Database which contains a column with the
We have a Oracle 9i database and OrderDetails table which has a column to
I have an Excel file (which has data imported from Oracle 10G Database) one
I have problem extracting data of the Oracle custom type from the database. One
I have a database table which currently holds geometric data in SRID 27700 (British
I have a table in an Oracle Database that has, among others, a DATE
I have a table in Oracle 11.2 database. I want the database to run
I have created a table on an Oracle 10g database with this structure :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.