Does oracle have a method to get substring based on number of bytes from a CLOB field?
select DBMS_LOB.SUBSTR(a.COMMENTS, 3998, 1)
FROM FOO;
I am getting error:
"ORA-06502: PL/SQL: numeric or value error: character string buffer too small"
. The problem was in special characters. Each new special character takes 8 bytes so when I reduce the string limit to 3992 then it works.
DBMS_LOB.SUBSTR(a.COMMENTS, 3992, 1) works.
For testing purpose I put many special characters and again it throws same error.
Does oracle have any method which finds substring based on number of bytes than number of characters?
Actually, we are fetching data from a table and need to display on UI with a limitation of 4000 characters. So, we want to fetch first 4000 characters only. As, a character size is 1 byte, we can accomodate 4000 bytes. So, if we use DBMS_LOB.CONVERTTOBLOB
, we may not be able to display properly the characters string fetched. Can we convert it back it charater string somehow?