Home » SQL & PL/SQL » SQL & PL/SQL » How to trim trailing spaces in DBMS_OUTPUT
How to trim trailing spaces in DBMS_OUTPUT [message #281108] Thu, 15 November 2007 14:23 Go to next message
open1
Messages: 3
Registered: November 2007
Location: fairfax
Junior Member
How to trim trailing spaces in DBMS_OUTPUT?
I need to produce ascii/binary file without trailing spaces on the line.
Re: How to trim trailing spaces in DBMS_OUTPUT [message #281110 is a reply to message #281108] Thu, 15 November 2007 14:28 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>How to trim trailing spaces in DBMS_OUTPUT?
RTRIM
Re: How to trim trailing spaces in DBMS_OUTPUT [message #281111 is a reply to message #281110] Thu, 15 November 2007 14:30 Go to previous messageGo to next message
open1
Messages: 3
Registered: November 2007
Location: fairfax
Junior Member
RTRIM does not work... try it yourself
maybe it because dbms_output puts it in a buffer which is a fixed size and fills in with the spaces.
Re: How to trim trailing spaces in DBMS_OUTPUT [message #281113 is a reply to message #281108] Thu, 15 November 2007 14:41 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
<comdb04-oracle@stagedb02.example.com:/a/oracle/tmp:> sqlplus -s dbadmin/admindb @tester.sql
2007-11-15 12:40:34

PL/SQL procedure successfully completed.

<comdb04-oracle@stagedb02.example.com:/a/oracle/tmp:> od -c tester.log
0000000   2   0   0   7   -   1   1   -   1   5       1   2   :   4   0
0000020   :   3   4  \n  \n   P   L   /   S   Q   L       p   r   o   c
0000040   e   d   u   r   e       s   u   c   c   e   s   s   f   u   l
0000060   l   y       c   o   m   p   l   e   t   e   d   .  \n  \n
0000077
<comdb04-oracle@stagedb02.example.com:/a/oracle/tmp:> cat tester.sql
spool tester.log
set serveroutput on trimspool on
declare
begin
dbms_output.enable(1000);
dbms_output.put_line(sysdate);
end;
/
exit

[Updated on: Thu, 15 November 2007 16:46] by Moderator

Report message to a moderator

Re: How to trim trailing spaces in DBMS_OUTPUT [message #281114 is a reply to message #281111] Thu, 15 November 2007 14:41 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
(LR)TRIM works, if you use it correctly.
Post we are wrong.
We don't trust you.

It is more likely that you use a linesize and don't trim spool or output.
In short, you do it wrong.

Regards
Michel
Re: How to trim trailing spaces in DBMS_OUTPUT [message #281115 is a reply to message #281111] Thu, 15 November 2007 14:47 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9104
Registered: November 2002
Location: California, USA
Senior Member
The following are excerpts from the online documentaiton:

SET TRIM[OUT] {ON | OFF}

Determines whether SQL*Plus puts trailing blanks at the end of each displayed line. ON removes blanks at the end of each line, improving performance especially when you access SQL*Plus from a slow communications device. OFF enables SQL*Plus to display trailing blanks. TRIMOUT ON does not affect spooled output.


SET TRIMS[POOL] {ON | OFF}

Determines whether SQL*Plus puts trailing blanks at the end of each spooled line. ON removes blanks at the end of each line. OFF enables SQL*Plus to include trailing blanks. TRIMSPOOL ON does not affect terminal output.

Re: How to trim trailing spaces in DBMS_OUTPUT [message #281124 is a reply to message #281113] Thu, 15 November 2007 16:18 Go to previous message
open1
Messages: 3
Registered: November 2007
Location: fairfax
Junior Member
trimspool on worked! thank you!
Previous Topic: Page Pagination with a Count (can this be done)
Next Topic: One result missing in a product
Goto Forum:
  


Current Time: Mon Feb 10 11:13:02 CST 2025