SQLPlus Compute
COMPUTE Command Syntax:
COMP[UTE] [function [LAB[EL] text] …
OF {expr|column|alias} …
ON {expr|column|alias|REPORT|ROW} …
function = AVG, COU[NT], MIN[IMUM], MAX[IMUM], NUM[BER], SUM, STD, VAR[IANCE]
COMPUTE Command Examples:
COMPUTE SUM OF PRICE ON REPORT
BREAK ON REPORT
COLUMN DUMMY HEADING ”
SELECT ‘ ‘ DUMMY, PRICE, PRODUCT_ID
FROM PRODUCTS_VIEW
WHERE PRICE> 5000
ORDER BY PRICE;
BREAK ON PRODUCT_NAME SKIP 1
COMPUTE
AVG LABEL ‘Average Price’ –
MAX LABEL ‘Maximum Price’ –
OF PRICEON PRODUCT_NAME
SELECT PRODUCT_ID, PRODUCT_NAME, PRICE
FROM PRODUCTS_VIEW
WHERE PRODUCT_NAME IN (‘HR Software’, ‘ERP Software’)
ORDER BY PRODUCT_NAME;