Assuming we have the following test1 table. Tried to do this question using break and sum commands in SQL*plus. Hope this helps.


SQL> select * from test1;

COL1 AMT
------------------------------ ----------
A1 1
A2 2
A3 3
A4 4
A5 5
A6 6
A7 7
A8 8
A9 9
A10 10
B21 21

COL1 AMT
------------------------------ ----------
B22 22
B23 23
B24 24
B25 25
B26 26
B27 27
B28 28
B29 29
B30 30
C4 4
C5 5

22 rows selected.

1 SELECT COL1, AMT, SUBSTR(COL1,1,1) FIRST
2* FROM TEST1

SQL> BREAK ON FIRST
SQL> Sum of Amt on First
SQL > /

COL1 AMT F
------------------------------ ---------- -
A1 1 A
A2 2
A3 3
A4 4
A5 5
A6 6
A7 7
A8 8
A9 9
A10 10
---------- *

COL1 AMT F
------------------------------ ---------- -
55 s
B21 21 B
B22 22
B23 23
B24 24
B25 25
B26 26
B27 27
B28 28
B29 29
B30 30

COL1 AMT F
------------------------------ ---------- -
---------- *
255 s
C4 4 C
C5 5
---------- *
9 s

22 rows selected.


--Anurag.