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!

Trying to understand the behavior of clob

RanagalJan 16 2019 — edited Jan 17 2019

Hello experts,

I have this below scenario.

set serveroutput ON;
DECLARE
    l_val_test1 CLOB;
    l_val_test2 CLOB;
BEGIN
    l_val_test1 := Lpad('X', 32767, 'X');

    --l_val_test2 := lpad('X',32768,'X'); This fails
    FOR i IN 1..15 LOOP
        l_val_test1 := l_val_test1|| l_val_test1;
    END LOOP;

    dbms_output.Put_line('Done');
EXCEPTION
    WHEN OTHERS THEN

dbms_output.Put_line('No some exception: '||SQLERRM);
END;

The above one works properly when executed. But fails when I remove the comment as shown by the underlined text. I mean I am confused how this clob works in Oracle. Is it the problem of lpad that can not pad 32768 'X's or what? Because when I run the for loop, It works fine.

Regards,

Ranagal

This post has been answered by Sven W. on Jan 16 2019
Jump to Answer
Comments
Post Details
Added on Jan 16 2019
34 comments
759 views