Oracle SQL - Use Multiple COMPUTEs

Introduction

In the following script, the BREAK "on region" has been enhanced to include a second BREAK, "on report,".

In this script, the size of the REGION column had to be expanded to 7 to include the words "maximum" and "minimum" because they appear in that column.

Demo

SET echo off 
COLUMN curr_salary FORMAT $9,999,999 --  ww  w .  j a v a2 s .  c o m
COLUMN ename FORMAT a10 
COLUMN region FORMAT a7 
BREAK ON region skip1 ON report 
COMPUTE sum max min of curr_salary ON region 
COMPUTE sum of curr_salary ON report 
SET verify off 
SELECT empno, ename, curr_salary, region 
FROM employee 
ORDER BY region 
/ 
CLEAR BREAKS 
CLEAR COMPUTES 
CLEAR COLUMNS 
SET verify on 
SET echo on

Related Topic