国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

SQLPlus命令使用指南(二)

2024-07-21 02:09:50
字體:
來源:轉載
供稿:網友

/*------------------------------------------------------------------------------------

/*歡迎轉載,請保留這部分信息

/*翁彥      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 [text|variable] ...] | [on|off]

 

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 {on|off}

    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

    on|off

wra[pped] | wor[d_wrapped] | tru[ncated]

 

下面就舉例說明:

sql> column sal alias salary format $99,990.90

我們指定了sal這個列的一個別名和數字的money顯示格式,下面的顯示結果顯示了設置后的效果。



圖1

關于format的提示:

¨         文字各式的設置,用a[n]來表示,n表示顯示的長度。那么這個文字列的顯示長度就按照n個字符的寬度,如果內容>n,就會自動轉行。如圖2

¨         日期格式,sqlplus缺省顯示的日期格式按照nls_lang設置來顯示。缺省是a9。那么,你可以通過設置數據庫啟動參數,或者sqlplus的環境變量,或者用alter session命令來規范日期的顯示;也可以通過to_char來轉換顯示內容;也可以用column命令來指定顯示長度。

¨         數字格式,說明一些常用的符號。如圖3

9             代表一個數字字符

0                           在指定的位置顯示前導0或后置0

$             美元貨幣符號

b             顯示一個空,如果是0的話

mi            顯示負號,如果小于0的話

,                     顯示千分位分隔符

.                     顯示小數點

g             和,一樣,顯示千分位分組符號

l              顯示本地區域的貨幣符號



圖2

 



圖 3

關于其他參數的提示

justify主要規定了列顯示內容的對齊方式。left ,right,center。

like指定該列的顯示參照某個其他列的顯示方法。如:column comm like sal

new line 換行顯示這個列的內容

null text  如果是null,顯示一個字符串,相當于isnull函數。

 

未完待續。。。。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 曲沃县| 徐水县| 句容市| 元氏县| 泰安市| 涿鹿县| 定州市| 民权县| 申扎县| 富蕴县| 阳泉市| 扎兰屯市| 浮梁县| 榕江县| 阿合奇县| 巴青县| 樟树市| 淳安县| 大同市| 沂南县| 承德市| 大丰市| 陇川县| 新泰市| 博湖县| 屏南县| 恩施市| 岫岩| 论坛| 米脂县| 基隆市| 思南县| 深圳市| 屏山县| 广汉市| 土默特左旗| 沛县| 凯里市| 连云港市| 河南省| 延津县|