第一个表没有任何长字符串,输出格式正确:
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
?
答案 0 :(得分: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
甲骨文: http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch6.htm#i1081008 (SQL * Plus用户指南和参考)