DBMS_LOB.SUBSTR failed to retrieve 4000 characters

From: <yuri.dench_at_gmail.com>
Date: Thu, 13 Nov 2008 11:32:45 -0800 (PST)
Message-ID: <4a41c694-5ff9-4f3a-a51d-4dbd5547de13@h23g2000prf.googlegroups.com>

Oracle throws the error when trying to retrieve first 4000 characters from a CLOB column

SELECT DBMS_LOB.SUBSTR(clob_column,4000, 1) FROM tbl

ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 1

Depends on the row it works fine only when I reduce the chunk size from 4000 to 3550 or even less.
I run it on Oracle 11G

Please advice what is a problem.

Thank you,
Yuri Received on Thu Nov 13 2008 - 13:32:45 CST

Original text of this message