1

第一个表没有任何长字符串,输出格式正确:

SQL> select * from Visit;

       SLOTNUM DATEVISIT ACTUALARR                                                                                     
    ---------- --------- ---------                                                                                     
            12 19-JUN-13 19-JUN-13                                                                                     
            15 20-JUN-13 20-JUN-13                                                                                     
            18 21-JUN-13 21-JUN-13                                                                                     

然而第二个表包含Description列,输出是一团糟......

SQL> select * from Treatment;

        TREATC NAME                       


    ------ --------------------                                                                                        
    DESCRIPTION                                                                                                        
    -------------------------------------------------------------------------------------------------------------------
    STANDARDFEE                                                                                                        
    -----------                                                                                                        
    WARNINGS                                                                                                           
    -------------------------------------------------------------------------------------------------------------------
    123456 Flu Shot                                                                                                    
    Treats insert into Treatment flu                                                                                   
           20.5                                                                                                        


    123458 Lungs Inhalation                                                                                            
    Treats cough only                                                                                                  
           10.5                                                                                                        
    May increase blood preassure 

我怎样才能让我的第二张桌子看起来不错spool

4

1 回答 1

2
SQL> SELECT * FROM sqlplus_tbl;

A_DATE
---------
A_VERY_LONG_STRING
--------------------------------------------------------------------------------
      A_ID
----------
20-JUN-13
Oracle. How to format a table containing description coulmns into spool output?
1.0000E+13

20-JUN-13
Oracle. How to format a table containing description coulmns into spool output?
2.0000E+13

A_DATE
---------
A_VERY_LONG_STRING
--------------------------------------------------------------------------------
      A_ID
----------

20-JUN-13
Oracle. How to format a table containing description coulmns into spool output?
3.0000E+13




SQL> COLUMN a_very_long_string FORMAT A79
SQL> COLUMN a_id FORMAT 99999999999999;
SQL> SELECT * FROM sqlplus_tbl;

A_DATE    A_VERY_LONG_STRING                                                                         A_ID
--------- ------------------------------------------------------------------------------- ---------------
20-JUN-13 Oracle. How to format a table containing description coulmns into spool output?  10000000000000
20-JUN-13 Oracle. How to format a table containing description coulmns into spool output?  20000000000000
20-JUN-13 Oracle. How to format a table containing description coulmns into spool output?  30000000000000

一些小帮助: http ://ss64.com/ora/syntax-sqlplus.html

Oracle: http ://docs.oracle.com/cd/B19306_01/server.102/b14357/ch6.htm#i1081008 (SQL*Plus 用户指南和参考)

于 2013-06-20T07:50:49.873 回答