Oracle SQL - SQL Plus BREAK

Introduction

"break" the report on some column to produce easy-to-read output.

Demo

SELECT empno, ename, curr_salary, region 
FROM employee -- from  w w  w  .  j  av a  2  s .  com
ORDER BY region;

BREAK ON region 

SELECT empno, ename, curr_salary, region 
FROM employee 
ORDER BY region;

If a blank line is desired between the regions, we can enhance the BREAK command with a skip like this:

Demo

BREAK ON region skip1 

SELECT empno, ename, curr_salary, region 
FROM employee -- www . java2s  . co m
ORDER BY region;

The query contains an ORDER BY clause that mirrors the BREAK command.

If the ORDER BY is not there, then the result will indeed break on REGION, but the result will contain random (i.e., unordered) breaks:

Demo

SELECT empno, ename, curr_salary, region 
FROM employee -- from w  ww  . ja  va 2s.c o m
-- ORDER BY region

There can be only one BREAK command in a script or in effect at any one time.

If there is a second BREAK command in a script or session, the second one will supersede the first.