This procedure prints the ASCII
code for each character in a string.
If executed in TOAD, it prints these ASCII codes: 55 48 48 32 32 32 32 32 32 32 49
which are the right ones.
If executed via SQLPLUS
on the UNIX
server and spool the output of the DBMS_OUTPUT.PUT_LINE (v_String);
to a text file, copy that output and assign it to the v_String and execute the procedure in TOAD, I get the following ASCII
codes 55 48 48 9 32 32 49
.
Why it is replacing 32 32 32 32 32 with 9. Essentially a tab.
CREATE OR REPLACE PROCEDURE My_Test
AS
v_String VARCHAR2 (25);
BEGIN
v_String := RPAD ('700', 10) || '1';
-- v_String:='700 1';
DBMS_OUTPUT.PUT_LINE (v_String);
DBMS_OUTPUT.PUT_LINE ('');
FOR i IN 1 .. LENGTH (v_String)
LOOP
DBMS_OUTPUT.PUT_LINE (ASCII (SUBSTR (v_String, i, 1)));
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE (SQLERRM);
END;