结合linesize,pagesize,col format很好的设置显示宽度

我们在使用sql*plus的时候,经常会遇到显示不下需要列的情况:

针对以上情况,我个人经常使用的方法如下:

(1)减少查询的列。------最笨的方法。

(2)设置显示的linesize,pagesize,结合col format 设置比较长的列的显示宽度。

比如

SQL>select file_name,tablespace_name,status,bytes from dba_data_files;

SQL> select file_name,tablespace_name,bytes,status from dba_data_files;

FILE_NAME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TABLESPACE_NAME                     BYTES STATUS
------------------------------ ---------- ---------
/ora10gBase/oradata/pskDB/users01.dbf
USERS                             5242880 AVAILABLE

/ora10gBase/oradata/pskDB/sysaux01.dbf
SYSAUX                          262144000 AVAILABLE

FILE_NAME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TABLESPACE_NAME                     BYTES STATUS
------------------------------ ---------- ---------

/ora10gBase/oradata/pskDB/undotbs01.dbf
UNDOTBS1                         26214400 AVAILABLE

/ora10gBase/oradata/pskDB/system01.dbf

FILE_NAME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TABLESPACE_NAME                     BYTES STATUS
------------------------------ ---------- ---------
SYSTEM                          503316480 AVAILABLE

/ora10gBase/oradata/pskDB/pskBigTbl.dbf
PSKBIGTBL                       104857600 AVAILABLE


FILE_NAME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TABLESPACE_NAME                     BYTES STATUS
------------------------------ ---------- ---------
/ora10gBase/oradata/pskDB/rman_ts.dbf
RMAN_TS                          20971520 AVAILABLE


6 rows selected.

就查询四列,但是却无法在一行中把一条记录显示出来,原因就是因为系统默认显示的宽度太短跟file_name varchar2(513)定义的长度有点长

SQL> desc dba_data_files;
 Name   Null?    Type
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------- ------------------------------------------------------------------------------------------------------------------------------------------------------------
 FILE_NAME    VARCHAR2(513)
 FILE_ID    NUMBER
 TABLESPACE_NAME    VARCHAR2(30)
 BYTES    NUMBER
 BLOCKS     NUMBER
 STATUS     VARCHAR2(9)
 RELATIVE_FNO    NUMBER
 AUTOEXTENSIBLE     VARCHAR2(3)
 MAXBYTES    NUMBER
 MAXBLOCKS    NUMBER
 INCREMENT_BY    NUMBER
 USER_BYTES    NUMBER
 USER_BLOCKS    NUMBER
 ONLINE_STATUS    VARCHAR2(7)

我们只要设置一下,以上问题就能解决:

SQL>set linesize 400;

SQL>col file_name format 50;

SQL> select file_name,tablespace_name,status from dba_data_files;

FILE_NAME                                          TABLESPACE_NAME                STATUS
-------------------------------------------------- ------------------------------ ---------
/ora10gBase/oradata/pskDB/users01.dbf              USERS                          AVAILABLE
/ora10gBase/oradata/pskDB/sysaux01.dbf             SYSAUX                         AVAILABLE
/ora10gBase/oradata/pskDB/undotbs01.dbf            UNDOTBS1                       AVAILABLE
/ora10gBase/oradata/pskDB/system01.dbf             SYSTEM                         AVAILABLE
/ora10gBase/oradata/pskDB/pskBigTbl.dbf            PSKBIGTBL                      AVAILABLE
/ora10gBase/oradata/pskDB/rman_ts.dbf              RMAN_TS                        AVAILABLE

6 rows selected.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14766526/viewspace-567188/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/14766526/viewspace-567188/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值