Toad World® Forums

debugging a varchar2(32000) variable is not possible

CREATE OR REPLACE PACKAGE BODY TEST_DEBUG
AS
PROCEDURE TEST_DEBUG_PRC
AS
V_TVAL VARCHAR2 (32000) := ’ ';

V_CVAL VARCHAR2 (1) := ‘a’;
N_CVAL VARCHAR2 (1);
V_NUM NUMBER;
BEGIN
FOR I IN 1 … 32000 / 100
LOOP
–DBMS_OUTPUT.PUT_LINE (I || ’ ’ || MOD (I, 26) || ’ ’ || CHR (ASCII (V_CVAL) + MOD (I, 27) - 1));
N_CVAL := CHR (ASCII (V_CVAL) + MOD (I, 27) - 1);
V_TVAL := RPAD (V_TVAL, CASE WHEN I = 32 THEN 999 ELSE I END * 100, N_CVAL);
V_NUM := LENGTH (V_TVAL);
– DBMS_OUTPUT.PUT_LINE (V_TVAL);
END LOOP;
END TEST_DEBUG_PRC;
END TEST_DEBUG;

------- debugging this soon v_tval is to see what it contains and it has a max of 32000 characters. this makes debugging large varcha2 varaible impossible to evaluate during debugging. , but dbms_output has no problem with its length as it grows.

This is a “feature” of the DBMS_DEBUG API that Oracle provides for debugging. Unfortunately, their API hasn’t been updated in quite a few years and hasn’t kept up with the advances in their ability to store large VARCHAR2 values. It’s also the only API we have available to use for debugging.