declare
/* ISSUE: SCRIPT_OUTPUT panel shows Trimmed leading spaces on the FIRST dbms_output line only!
DEMO: Run script w/ commented lines. Observe the printed result is trimmed leading spaces.
The printed value should have leading spaces because it is smaller than the mask length.
ILLUSTRATE: Remove either --commented statement and observe the difference. Output IS NOT trimmed.
The printed value HAS leading spaces (as it should).
*/
mask$ varchar2(128) := '999,999,999';
pad# constant integer := 25;
scale$ constant varchar2(25) := '1234567890123456789012345';
amount integer;
begin <<main>>
amount := 0; -- or 6517238;
sys.dbms_output.enable;
--sys.dbms_output.put_line(chr(10));
--sys.dbms_output.put_line(scale$);
sys.dbms_output.put_line(LPAD(TO_CHAR(amount,mask$), pad#,' '));
sys.dbms_output.put_line(LPAD(TO_CHAR(amount,mask$), pad#,'*'));
end;