PL/SQL (MOSC)

MOSC Banner

Inserting duplicate rows with negative amount from a previous record in Oracle PLSQL

in PL/SQL (MOSC) 3 commentsAnswered

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

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center