SQLPlus command usage guide (3)

zhaozj2021-02-16  51

SQLPlus command usage guide (3)

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

Author: Weng Yan

Time: 2004-3-9

Welcome to reprint, please keep the author information

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

(3) BREAK command

With Break, you can print some of the contents you need, such as small, repeated column values ​​do not display, or insert an empty line in each packet.

Clear Break settings, Clear Breaks.

grammar:

Break

-----

Specifies Where and how to make format change. 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]]

described as follows:

SQL> BREAK on Deptno

The result is shown in Figure 4

Figure 4

By setting the break command for a column, we removed the value of deptno repeatedly displayed. Please compare the situation without BREAK. This usage is called Break Column. The columns in the Break command should appear in the order by the SQL statement, if there are multiple columns in the order by the order, there are also multiple columns of Break usage. Figure 5.

Description of Break parameters

¨ SKIP [N], automatically insert N space lines before each group value appears

¨ Skip Page, automatically change the page before each group value appears

¨ Break on row Skip [N], inserts N of N-Boards after each row.

¨ NODUP repeat display empty, DUP repeats also display.

BREAK is as good as defining an event. When the value changes, the results of the query can be performed a specific operation. Break and compute commands can be used together to generate small metering reports. Figure 5

(4) Compute command

At the end of the result, a row of statistics on the final display. If there are multiple computes, then only the last Compute works. Clear Computes Deletes all set computers.

grammar:

Compute

-------

Calculates and Prints Summary Lines, USING VARIOS 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 and break are used together. There is no effect without the compute without a Break statement. The general usage is as follows:

Break on Break_Column

Compute function label label_name of column column column

... On Break_ColumnCompute execution calculation operations mainly:

Sum

Computes the amount of the value 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 value in the colorn.std

Computes The Standard Deviation of The VALUES in The Column.variance

Computes the variance of the value in the colorn.count

Computes the number of non-null val values ​​in the column.number

The following coluMn. The following is an example of compute calculation. Figure 6 Figure 6

Description of Compute parameters

¨ Label assigns a specified name. Such as Compute Sum Label 'Total' of Sal On Job, then this line is tap, it will show Total instead of default SUM

You don't need to print any labels, use Dummy. As shown in Figure 7, Dummy's use is still useful in SQL * PLUS report production. Figure 7 is endless. . . . .

转载请注明原文地址:https://www.9cbs.com/read-23627.html

New Post(0)