SQLPlus converts to tabs only when run via script

From: Rich Jesse <rjoralist_at_society.servebeer.com>
Date: Wed, 26 Aug 2009 10:09:59 -0500 (CDT)
Message-ID: <8d6b73cb32078d5fda46a7e19bc2eaed.squirrel_at_society.servebeer.com>

Hey all,

In on AIX, we ran across an issue that ended up showing us that SQLPlus was converting spaces to tabs, which was causing an occasional issue in our auditable SQLPlus spooled output.

No biggie, as I'll handily add a TAB OFF to the existing SET command in the SQLPlus script, right? But I thought I should verify the problem first, so I ran this interactively from SQLPlus:

whenever sqlerror exit rollback
spool ./ti.txt
set pagesize 100 linesize 160 trimspool on connect / as sysdba
set echo on
show all

select '        test' from dual;
select '        test        ' from dual;

Note there are exactly 8 spaces before the first "test" and 8 before and after the second. However, the ti.txt file has NO tabs in it, despite the output from the "show all" command saying "tab ON".

When the procedure is run in production, it's via script, so I pasted the above script into a file called "t.sql" and ran it:

sqlplus /nolog _at_t

Lo and behold, the spool file has tabs! However, the only tabs are before the word "test" and only in the echoed SELECT statement. It did not replace the spaces after the word "test" nor in the output from the SELECT. And like before, the "show all" output is identical -- "tab ON".

I have a login.sql in $HOME that sets linesize and pagesize, and the default glogin.sql in ?/sqlplus/admin, which has COLUMN statements and sets sqlprompt, linesize, and pagesize -- no tab settings in either. SQLPATH is not set.

The only difference is that the one run from a script has tabs and the other pasted into SQLPlus doesn't.

Adding "tab OFF" to $HOME/login.sql works, but I don't think I've seen this behavior before. Sound familiar to anyone?


Received on Wed Aug 26 2009 - 10:09:59 CDT

Original text of this message