Question

The first table does not have any long strings and the output is well formatted:

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                                                                                     

However second table contains Description column, and the output is a complete mess...

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 

How can I make my second table look nice in the spool?

Was it helpful?

Solution

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

Some small help: http://ss64.com/ora/syntax-sqlplus.html

Oracle: http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch6.htm#i1081008 (SQL*Plus User's Guide and Reference)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top