Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

formatting issue - extra space between the columns in 11g client

627703Mar 4 2012 — edited Mar 4 2012
Hi,

We recently upgraded the oracle client from 10g to 11g. The following script produces the different outputs when using the different oracle clients ( 10.2.0.2.0, 11.1.0.6.0). Both of clients connects to the same Oracle 11g database.

The output for Oracle 10g client (no extra space between the columns) -
ABC
ABC

The output for Oracle 11g client(having an extra space between the columns) -
A B C
A B C

The script that I used is


set serveroutput on
set verify off
set newpage 0
set space 0
set pagesize 0
set echo off
set feedback off
set termout off
set heading off
set colsep ""
set linesize 124

spool ./output.txt

column GEO_UNIT format a1 truncate
column RECORD_TYPE format a1 truncate
column SALES_FORCE_CODE format a2 truncate

SELECT 'A', 'B', 'C'
FROM TBL_XXX where rownum <3;

spool off
exit

I got the extra space between the columns using 11g client even I specified ZERO space between columns, how to get the same output as I got in Oracle 10g?

Thanks a lot for your help!
Liz

Comments

sb92075
What SET SPACE command?
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

15:21:39 SQL> help set space
SP2-0172: No HELP matching this topic was found.
15:21:43 SQL> help set

 SET
 ---

 Sets a system variable to alter the SQL*Plus environment settings
 for your current session. For example, to:
     -   set the display width for data
     -   customize HTML formatting
     -   enable or disable printing of column headings
     -   set the number of lines per page

 SET system_variable value

 where system_variable and value represent one of the following clauses:

   APPI[NFO]{OFF|ON|text}                   NEWP[AGE] {1|n|NONE}
   ARRAY[SIZE] {15|n}                       NULL text
   AUTO[COMMIT] {OFF|ON|IMM[EDIATE]|n}      NUMF[ORMAT] format
   AUTOP[RINT] {OFF|ON}                     NUM[WIDTH] {10|n}
   AUTORECOVERY {OFF|ON}                    PAGES[IZE] {14|n}
   AUTOT[RACE] {OFF|ON|TRACE[ONLY]}         PAU[SE] {OFF|ON|text}
     [EXP[LAIN]] [STAT[ISTICS]]             RECSEP {WR[APPED]|EA[CH]|OFF}
   BLO[CKTERMINATOR] {.|c|ON|OFF}           RECSEPCHAR {_|c}
   CMDS[EP] {;|c|OFF|ON}                    SERVEROUT[PUT] {ON|OFF}
   COLSEP {_|text}                            [SIZE {n | UNLIMITED}]
   CON[CAT] {.|c|ON|OFF}                      [FOR[MAT]  {WRA[PPED] |
   COPYC[OMMIT] {0|n}                          WOR[D_WRAPPED] |
   COPYTYPECHECK {ON|OFF}                      TRU[NCATED]}]
   DEF[INE] {&|c|ON|OFF}                    SHIFT[INOUT] {VIS[IBLE] |
   DESCRIBE [DEPTH {1|n|ALL}]                 INV[ISIBLE]}
     [LINENUM {OFF|ON}] [INDENT {OFF|ON}]   SHOW[MODE] {OFF|ON}
   ECHO {OFF|ON}                            SQLBL[ANKLINES] {OFF|ON}
   EDITF[ILE] file_name[.ext]               SQLC[ASE] {MIX[ED] |
   EMB[EDDED] {OFF|ON}                        LO[WER] | UP[PER]}
   ERRORL[OGGING] {ON|OFF}                  SQLCO[NTINUE] {> | text}
     [TABLE [schema.]tablename]             SQLN[UMBER] {ON|OFF}
     [TRUNCATE] [IDENTIFIER identifier]     SQLPLUSCOMPAT[IBILITY] {x.y[.z]}
   ESC[APE] {\|c|OFF|ON}                    SQLPRE[FIX] {#|c}
   ESCCHAR {@|?|%|$|OFF}                    SQLP[ROMPT] {SQL>|text}
   EXITC[OMMIT] {ON|OFF}                    SQLT[ERMINATOR] {;|c|ON|OFF}
   FEED[BACK] {6|n|ON|OFF}                  SUF[FIX] {SQL|text}
   FLAGGER {OFF|ENTRY|INTERMED[IATE]|FULL}  TAB {ON|OFF}
   FLU[SH] {ON|OFF}                         TERM[OUT] {ON|OFF}
   HEA[DING] {ON|OFF}                       TI[ME] {OFF|ON}
   HEADS[EP] {||c|ON|OFF}                   TIMI[NG] {OFF|ON}
   INSTANCE [instance_path|LOCAL]           TRIM[OUT] {ON|OFF}
   LIN[ESIZE] {80|n}                        TRIMS[POOL] {OFF|ON}
   LOBOF[FSET] {1|n}                        UND[ERLINE] {-|c|ON|OFF}
   LOGSOURCE [pathname]                     VER[IFY] {ON|OFF}
   LONG {80|n}                              WRA[P] {ON|OFF}
   LONGC[HUNKSIZE] {80|n}                   XQUERY {BASEURI text|
   MARK[UP] HTML [OFF|ON]                     ORDERING{UNORDERED|
     [HEAD text] [BODY text] [TABLE text]              ORDERED|DEFAULT}|
     [ENTMAP {ON|OFF}]                        NODE{BYVALUE|BYREFERENCE|
     [SPOOL {OFF|ON}]                              DEFAULT}|
     [PRE[FORMAT] {OFF|ON}]                   CONTEXT text}


15:21:48 SQL> 
unknown-7404
>
What SET SPACE command?
>
Maybe he meant this obsolete one?
SQL> select * from v$version;
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL>
SQL> set space 10
SQL>
SQL> set space 11
SP2-0267: space option 11 out of range (0 through 10)
SQL>
SQL*Plus User's Guide 11.1 - http://docs.oracle.com/cd/B28359_01/server.111/b31189.pdf
>
SET SPACE {1|n} (obsolete)
Sets the number of spaces between columns in output. The maximum value of n is 10.
The SET SPACE 0 and SET COLSEP " commands have the same effect. This command
is obsoleted by SET COLSEP, but you can still use it for backward compatibility. You
may prefer to use COLSEP because the SHOW command recognizes COLSEP and
does not recognize SPACE.
{quote}
unknown-7404
Use 'colsep' with a space
SQL> set colsep ""
SQL> select 'A', 'B', 'C' FROM DUAL;
ABC
SQL> set colsep " "
SQL> select 'A', 'B', 'C' FROM DUAL;
A B C
SQL>
627703
the extra space goes away after I used alais.

SELECT 'A' as A, 'B' as B, 'C' as C
FROM TBL_XXX where rownum <3;

Thanks a lot for all your help!
Liz
1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 1 2012
Added on Mar 4 2012
4 comments
5,443 views