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 8439549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:01:34+00:00 2026-06-10T08:01:34+00:00

In my project i use oracle as primary database and i’ve faced a problem

  • 0

In my project i use oracle as primary database and i’ve faced a problem with parsing clob. So suppose we have a clob with value

   aaaaaa
   cccccc
   bbbbbb

And it’s stored in table test …

I need to write plsql procedure to get this clob and split it so that i will have array with three items [aaaaaa,cccccccc,bbbbbbb].

Is there any possible solutions?

  • 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-10T08:01:35+00:00Added an answer on June 10, 2026 at 8:01 am

    Here is a piece of code that works.
    I suggest that you use explicit cursors instead of implicit ones (FOR i IN (select…)), for performance purpose.

    First here is the script to create testcase.

    create table test (c clob);
    
    insert into test (c) values (
    'azertyuiop
    qsdfghjklm
    wxcvbn
    ');
    

    Then here is the script to read line by line Clob :

    /* Formatted on 28/08/2012 14:16:52 (QP5 v5.115.810.9015) */
    declare
        nStartIndex number := 1;
        nEndIndex number := 1;
        nLineIndex number := 0;
        vLine varchar2(2000);
    
        cursor c_clob is
        select c from test;
    
        c clob;
        -------------------------------
        procedure printout
           (p_clob in out nocopy clob) is
          offset number := 1;
          amount number := 32767;
          len    number := dbms_lob.getlength(p_clob);
          lc_buffer varchar2(32767);
          i pls_integer := 1;
        begin
          if ( dbms_lob.isopen(p_clob) != 1 ) then
            dbms_lob.open(p_clob, 0);
          end if;
          amount := instr(p_clob, chr(10), offset);
          while ( offset < len )
          loop
            dbms_lob.read(p_clob, amount, offset, lc_buffer);
            dbms_output.put_line('Line #'||i||':'||lc_buffer);
           offset := offset + amount;
           i := i + 1;
          end loop; 
              if ( dbms_lob.isopen(p_clob) = 1 ) then
            dbms_lob.close(p_clob);
          end if; 
        exception
          when others then
             dbms_output.put_line('Error : '||sqlerrm);
        end printout;
        ---------------------------
    begin
        dbms_output.put_line('-----------');
        open c_clob;
        loop
           fetch c_clob into c;
           exit when c_clob%notfound;
           printout(c);
        end loop;
        close c_clob;
    end;
    

    ‘amount’ variable is used to detect end of line position. Be carfull, in some case the end of line is CHR(10)||CHR(13) (CR + LF), and in some other cases it is only CHR(10).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use Hibernate on my Java project, I have Oracle DB. An ID column,
In a upcoming project I'm going to use NHibernate with Oracle. I have used
I have a project which needs to use NHibernate to communicate with my Oracle
We have a project that needs reporting capabilities, but the backing database is Oracle
I have an AS3 project making use of compile time constants. This has worked
I'm looking for a good ORM for an upcoming project. The database will have
I am using Fluent NHibernate on a project that has an Oracle 10g database.
We use Oracle on a project and would like to also support MySQL. How
I want to use Oracle XE DB in my ASP.NET MVC project. I installed
I am working on a project that is using an Oracle database with stored

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.