Debug issues using sys.htp.prn

rbrooker

Member³
Good morning Marco,

I have a package that produces HTP output that I am trying to iron the wrinkles out of. When I am debugging the code, I often have the debug window open (on the HTP Output tab) and the editor open as well so that i can make a quick change and then test it.

After changing the code and compiling, I hit F8 in the test window and i get the following error message:

Code:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.OWA_UTIL", line 354
ORA-06512: at "SYS.HTP", line 1418
ORA-06512: at "SYS.HTP", line 1494
ORA-06512: at "NOMOSONE_DEV.PKG_MISC", line 1044
ORA-06512: at "NOMOSONE_DEV.RSB_PKG_MGR_IFRS_JOURNAL_ENTRS", line 4562
ORA-06512: at line 3

View program sources of error stack?

Click ok, press F8 again and execution occurs as expected.

This is more a nuisance than anything else (nothing breaks), but what should I be doing to avoid this error?
 
I'm not sure what could cause this. Perhaps if you connect as SYS and check line 354 of package body OWA_UTIl and lines 1418 and 1494 of package body HTP you can find a clue?
 
At the top of your test window, add:

Code:
htp.HTBUF_LEN := FLOOR(255/4);

This is assuming you use AL32UTF8 as a character set, which uses up to 4 bytes per character. If you use a different character set you can change the "4" to a more appropriate number if you want, but "4" works as well.

The reason this is necessary is due to the following in the sys.htp package header:

Code:
HTBUF_LEN number := 255;
type htbuf_arr is table of varchar2(256) index by binary_integer;

This array is defined as 256 bytes, but HTBUF_LEN defines a length in characters. If you use a multi-byte character set, you need to adjust HTBUF_LEN accordingly before you can use the htp package for output.

You can search the internet for "oracle HTBUF_LEN" to get some more information.
 
Back
Top