By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE table_name (Debit_String, Credit_String, Debit_Amount, Credit_Amount) AS
SELECT 'ING1', 'ING2', 123, 0 FROM DUAL UNION ALL
SELECT 'INT2', 'INT5', 234, 0 FROM DUAL;
2 rows affected
SELECT *
FROM table_name
UNPIVOT (
(string, amount) FOR type IN (
(debit_string, debit_amount ) AS 'D',
(credit_string, credit_amount) AS 'C'
)
);
TYPE | STRING | AMOUNT |
---|---|---|
D | ING1 | 123 |
C | ING2 | 0 |
D | INT2 | 234 |
C | INT5 | 0 |