ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 结合linesize,pagesize,col format很好的设置显示宽度

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

原创 Linux操作系统 作者:freshairpeng 时间:2009-03-13 14:58:28 0 删除 编辑

我们在使用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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-02-25

  • 博文量
    69
  • 访问量
    246283