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

首頁 > 開發 > 綜合 > 正文

SQLPlus命令使用指南(三)

2024-07-21 02:09:51
字體:
來源:轉載
供稿:網友
  • 網站運營seo文章大全
  • 提供全面的站長運營經驗及seo技術!

  • sqlplus命令使用指南(三)

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

    作者:翁彥 

    時間:2004-3-9

    歡迎轉載,請保留作者信息

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

    (3)   break命令

    利用break你可以打印出報表需要的一些內容,如小計,重復的列值不顯示,或者每個分組插入一個空行等等。

    清除break設置,clear breaks。

    語法:

    break

     -----

     

     specifies where and how to make format changes to a report.

     

     bre[ak] [on report_element [action [action]]] ...

     

     where report_element has the following syntax:

         {column | expression | row | report}

     

     and where action has the following syntax:

    [ski[p] n | [ski[p]] page] [nodup[licates] | dup[licates]]

    說明如下:

    sql>break on deptno

    得到的結果如圖4



    圖4

    通過對某個列設置break命令,我們去掉了重復顯示deptno的值。請仔細對比一下沒有break的情況。這種用法稱為break column的用法。break命令中的列應該要出現在sql語句的order by中,如果order by中有多個列,也有多個列的break用法。如圖5。

    break參數的說明

    ¨         skip[n],在每個分組值出現前,自動插入n個空行

    ¨         skip page, 在每個分組值出現前,自動換頁

    ¨         break on row skip[n],每一行后面插入n個空行。

    ¨         nodup重復的顯示空,dup重復的也顯示。

    break好比定義了一個事件,當值發生了變化后,可以對查詢的結果執行一個特定的操作。break和compute命令一起用,就可以產生小計等報表效果。



    圖5

     

    (4)  compute命令

    在結果的最后顯示一行統計行。如果有多個compute,那么只有最后一個compute才起作用。clear computes刪除所有設定的compute。

    語法:

    compute

     -------

     

     calculates and prints summary lines, using various standard

     computations, on subsets of selected rows. it also lists all

     compute definitions.

     

     comp[ute] [function [lab[el] text] ...

       of {expr|column|alias} ...

       on {expr|column|alias|report|row} ...]

     

    compute和break一起使用的。沒有break語句的compute沒有任何效果。一般的用法如下:

    break on break_column

    compute function label label_name of column column column

    ... on break_column

    compute執行的計算操作主要有:


    sum

    computes the sum of the values in the column.

    minimum

    computes the minimum value in the column.

    maximum

    computes the maximum value in the column.

    avg

    computes the average of the values in the column.

    std

    computes the standard deviation of the values in the column.

    variance

    computes the variance of the values in the column.

    count

    computes the number of non-null values in the column.

    number

    computes the number of rows in the column.


    下面是一個compute計算的例子。如圖6



    圖6

    compute參數的說明

    ¨             label為計算指定一個名稱。如compute sum label ‘total’ of sal on job,那么在小計這一行,會顯示total,而不是缺省的sum

    不需要打印任何標簽,就使用dummy。如圖7,dummy的使用在sql*plus報表制作上還是很有用的。



    圖7

    未完待續。。。。。
    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 林西县| 邯郸市| 云南省| 海门市| 泉州市| 济宁市| 杂多县| 高平市| 五常市| 新宾| 南昌县| 息烽县| 迭部县| 绥中县| 梅州市| 大荔县| 将乐县| 遂川县| 乌海市| 沙雅县| 象山县| 怀柔区| 天门市| 康保县| 舟山市| 色达县| 溆浦县| 思茅市| 绥芬河市| 广汉市| 皮山县| 青龙| 保山市| 无棣县| 鄂尔多斯市| 上林县| 罗甸县| 临沭县| 仪陇县| 界首市| 中宁县|