Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

CLOB Read

934101Jun 3 2016 — edited Jun 3 2016

Hi All,

I have a table having CLOB column. I am reading CLOB and printing details into a concurrent program output using below code. Now problem is while reading LOB on loop it's skipping LOB data i.e.

Reading from 1-10000 then skipping 10001-19999 again reading 20000-29999 skiping 30000-39999.

Please suggest why its happening.

DECLARE

   c   CLOB;

   PROCEDURE print_clob (p_clob IN CLOB)

   IS

      v_offset       NUMBER DEFAULT 1;

      v_chunk_size   NUMBER := 10000;

   BEGIN

      LOOP

         EXIT WHEN v_offset > DBMS_LOB.getlength (p_clob);

         DBMS_OUTPUT.put_line (

            DBMS_LOB.SUBSTR (p_clob, v_chunk_size, v_offset));

         v_offset := v_offset + v_chunk_size;

      END LOOP;

   END print_clob;

BEGIN

   FOR i IN 1 .. 10000

   LOOP

      c := c || 'test';

   END LOOP;

   print_clob (c);

END;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 1 2016
Added on Jun 3 2016
9 comments
2,149 views