开发者

How can I remove trailing spaces & extra new line while spooling output?

Trailing spaces in the spooled output rpad(' ',40) are getting truncated. If i remove the SET TRIMSPOOL on option the line size becomes 400 and there is a extra new line after each 开发者_开发百科select query. What options i need to have the trailing spaces at the end and remove the extra new line.

SET SERVEROUTPUT ON
SET VERIFY OFF
SET FEEDBACK OFF
SET HEADING OFF
SET LINESIZE 400
SET TRIMSPOOL ON
SET PAGESIZE 0
SPOOL ${T_SPOOL}    

SELECT '0' || rpad(' ',17) || '01' || 'WBC' || rpad(' ',7) || rpad('Accounts ',26) ||     '407081' || rpad('REF',12)  || to_char(sysdate, 'DDMMYY') || rpad(' ',40)
from dual;


Since your lines all have the same fixed length, you can remove the TRIMSPOOL setting and change the LINESIZE setting to match the length required e.g.

SET LINESIZE 120

(120 was the figure I came up with via a quick mental tot-up, it may be incorrect).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜