My current result:
| Column A | Column B | Column B |
|---|---|---|
| 01 | AB | col_amount |
| 01 | AB | col_amount |
| 01 | AB | col_amount |
| 02 | OA | col_amount |
| 03 | OE | col_amount |
| 03 | OE | col_amount |
| 04 | DB | col_amount |
I want to this output:
| Column A | Column B | Column B |
|---|---|---|
| 01 | AB | col_amount |
| col_amount | ||
| col_amount | ||
| 02 | OA | col_amount |
| 03 | OE | col_amount |
| col_amount | ||
| 04 | DB | col_amount |
If you do not have a client application that supports the
BREAKcommand (which is not an SQL command but is a command for the SQL*Plus client or other similar clients) then you can use theROW_NUMBERanalytic function andCASEexpressions:Which, for the sample data:
Outputs:
Note: In Oracle,
NULLand an empty string are identical.fiddle