Inserting duplicate rows with negative amount from a previous record in Oracle PLSQL
This is on Oracle database extreme performance 19c.
I have a requirement where we need to create same set of rows that is equal to number of rows already present in the table and then update the amount. Basically, we are looking to create two sets of identical rows in the able where only difference is positive and negative amounts, similar to the table below. I need to generate negative amount rows for every positive amount row that is already existing in the table.
This is how end product should look like:
How can I achieve this? Currently the table only has positive rows