Hi Anand,
Formatting the Query results will satisfy your above format & the query is,
Code:
break on deptno skip 0
select deptno, empno, ename
from emp
order by deptno
EMPNO ENAME DEPTNO
---------- ---------- ----------
7782 CLARK 10
7839 KING
7934 MILLER
7369 SMITH 20
7876 ADAMS
7902 FORD
7499 ALLEN 30
7698 BLAKE
7654 MARTIN
The skip line_number can be changed to skip the no of lines required. skip 1 will skip one line after the first set of records.
For further more formatting, the heading & pagesize can be modified so that the format represents more elegance.