Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying spaces in dbms_output.put_line

Status
Not open for further replies.

unisysguru

Programmer
May 16, 2001
10
US
I am new, so please forgive my ignorance. I am trying to output data with leading spaces, this is truncated.

dbms_output.put_line(lpad('CREATE: ',30||mydate));

it displays as:

CREATE: 20040101

instead of

CREATE: 20040101

Why is this happening?
Thanks
Bill Pendleton
 
Unisys,

The problem is not YOUR ignorance...The problem comes from ORACLE's ignorance !!! They built a REALLY STUPID "feature" into the DBMS_OUTPUT.PUT_LINE procedure that left trims spaces from output strings. What I do to workaround the problem is use a non-printing ("space-like") character [such as CHR(160)]when outputting leading "spaces":
Code:
exec dbms_output.put_line(lpad('CREATE: '||sysdate,30,chr(160)))
             CREATE: 17-JUN-04

Let us know if this resolves your need.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 17:24 (17Jun04) UTC (aka "GMT" and "Zulu"), 10:24 (17Jun04) Mountain Time)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top