The database is Oracle 18c XE.
I'm calling a PL/SQL procedure from an Apex application, but the issue is with the htp package, not the app. I want to display an HTML email message which is over 32k characters and is stored in a CLOB in the database.
I'm getting errors like this:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "SYS.HTP", line 1578
ORA-06512: at "SYS.HTP", line 1758
What I'm trying to do is divide the document into segments in a loop and call htp.p for each one so that the whole document is displayed. I know that htp.p has an input limit of 32k characters for a single-byte character set. The document character set is UTF-8 and the database character set is AL32UTF8.
My testing shows that if I call htp.p once with a document of size < 19887 characters no error is raised. Any more than that causes the error. If I split the document into two equal parts and call htp.p twice in succession, it works as long as the total length is less than 19887, so I'm limited to displaying only a part of the document whether I call htp.p only once or many times.
Any ideas about what I'm doing wrong?