COMPUTE CLPPlus command

The COMPUTE CLPPlus command executes a specified function on the aggregate values of a defined column. The command works in conjunction with the BREAK CLPPlus command.

Invocation

You must run this command from the CLPPlus interface.

Authorization

None

Required connection

You must be connected to a database.

Command syntax

Read syntax diagramSkip visual syntax diagramCOMPUTESUMMAXMINAVGCOUNTNUMSTDVARLABELtextOFcolumn1ONcolumn2

Command parameters

SUM
The SUM function adds the aggregate values on the column specified.
MIN
The MIN function returns the smallest of the aggregate values on the column specified.
MAX
The MAX function returns the largest of the aggregate values on the column specified.
AVG
The AVG function returns the average of the aggregate values on the column specified.
COUNT
The COUNT function counts the number of non-null values on the column specified.
NUM
The NUM function returns the number of aggregate rows processed on the column specified.
STD
The STD function returns the standard deviation of the aggregate values on the column specified.
VAR
The VAR function returns the variance of the aggregate values on the column specified.
LABEL text
Defines the text label that precedes the output of the function specified.
column1
Specifies the column on which the function is executed.
column2
Specifies the column on which the BREAK command is executed against.

Example

The following example highlights the usage of the COMPUTE command in conjunction with the BREAK command.

    SQL> BREAK ON WORKDEPT SKIP 2;
    SQL> COMPUTE AVG LABEL "Average" OF SALARY ON WORKDEPT;
    SQL> COMPUTE MAX LABEL "Maximum" OF SALARY ON WORKDEPT;
    SQL> SELECT WORKDEPT, EMPNO, SALARY FROM EMPLOYEE ORDER BY WORKDEPT;

Here is the output of the commands in the example.

          WORKDEPT   EMPNO   SALARY 
          --------   -----   ------
          A01        00100   75000.00
          A01        00101   80000.00
          A01        00102   70000.00
          ********           ------
          Average            75000.00
          Maximum            80000.00


          A02        00103   80000.00
          A02        00104   90000.00
          A02        00105   85000.00
          ********           ------ 
          Average            85000.00 
          Maximum            90000.00