选择显示字体大小

sqlplus命令使用指南(二) enhydraboy(原作)


  
   
关键字     sqlplus 命令 使用指南  
   
  
/*------------------------------------------------------------------------------------
  
/*欢迎转载,请保留这部分信息
  
/*翁彦      2004-1-15
  
/*------------------------------------------------------------------------------------
  
五 报表制作命令
  
报表制作命令是最重要的sql*plus命令,也是dba经常用到的。下面,就让我简单地说明一下。
  
(1)    ttitle命令
  
放置一个报表的标题。
  
语法:
  
ttitle
  
------
  
   
  
places and formats a title at the top of each report page.
  
enter ttitle with no clause to list its current definition.
  
   
  
the old form of ttitle is used if only a single word or
  
a string in quotes follows the ttitle command.
  
   
  
tti[tle] [printspec [textvariable] ...] [onoff]
  
   
  
where printspec is one or more of the following clauses:
  
   
  
     col n          le[ft]        bold
  
     s[kip] [n]     ce[nter]      format text
  
tab n          r[ight]
  
主要参数的说明:
  
¨         报表标题的显示的位置,有left,center决定
  
¨         还可以使用用户的变量(内容有系统来维护),如sql.pno页号, sql.lno行号等等
  
¨         col[n] 就是在第几个字符位置开始显示标题。
  
   
  
(2)    column命令
  
这个命令主要用途,是规范查询的结果的输出格式。输出格式包括了数字也可以指定显示的宽度。column设置后,一直保持有效。除非,你重新使用column设置该列或者用column <column name> clear。
  
语法:
  
column
  
------
  
   
  
specifies display attributes for a given column, such as:
  
     - column heading text
  
     - column heading alignment
  
     - number data format
  
     - column data wrapping
  
   
  
also lists the current display attributes for a single column
  
or all columns.
  
   
  
col[umn] [{column expr} [option...] ]
  
   
  
where option is one of the following clauses:
  
     ali[as] alias
  
     cle[ar]
  
     entmap {onoff}
  
     fold_a[fter]
  
     fold_b[efore]
  
     for[mat] format
  
     hea[ding] text
  
     jus[tify] {l[eft] c[enter] c[entre] r[ight]}
  
     like {expr alias}
  
     newl[ine]
  
     new_v[alue] variable
  
     nopri[nt] pri[nt]
  
     nul[l] text
  
     old_v[alue] variable
  
     onoff
  
wra[pped] wor[d_wrapped] tru[ncated]
  
   
  
下面就举例说明:
  
sql> column sal alias salary format &#36;99,990.90
  
我们指定了sal这个列的一个别名和数字的money显示格式,下面的显示结果显示了设置后的效果。
  
图1
  
关于format的提示:
  
&#168;         文字各式的设置,用a[n]来表示,n表示显示的长度。那么这个文字列的显示长度就按照n个字符的宽度,如果内容>n,就会自动转行。如图2
  
&#168;         日期格式,sqlplus缺省显示的日期格式按照nls_lang设置来显示。缺省是a9。那么,你可以通过设置数据库启动参数,或者sqlplus的环境变量,或者用alter session命令来规范日期的显示;也可以通过to_char来转换显示内容;也可以用column命令来指定显示长度。
  
&#168;         数字格式,说明一些常用的符号。如图3
  
9             代表一个数字字符
  
0                           在指定的位置显示前导0或后置0
  
&#36;             美元货币符号
  
b             显示一个空,如果是0的话
  
mi            显示负号,如果小于0的话
  
,                     显示千分位分隔符
  
.                     显示小数点
  
g             和,一样,显示千分位分组符号
  
l              显示本地区域的货币符号
  
图2
  
   
  
图 3
  
关于其他参数的提示
  
justify主要规定了列显示内容的对齐方式。left ,right,center。
  
like指定该列的显示参照某个其他列的显示方法。如:column comm like sal
  
new line 换行显示这个列的内容
  
null text  如果是null,显示一个字符串,相当于isnull函数。


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons