Skip to content
Advertisement

insert missing row in table oracle

I have data in table like below:

We have primary_ID and Secondary_ID column. for serial_ID 100 we have 3 primary and 3 secondary records ..If you see the data Primary_ID become secondary and secondary become primary(3 each).but for serial_id 200 we have 4 primary records but 3 secondry records..

I want to insert missing record in the table.For ex serial_id 200 has missing data for primary ID 28 so insert this into table.Please assist

Advertisement

Answer

You can use something like this. In the temp_table, I put rows into two different types (‘P’ or ‘S’).

I assume that the queue_id = ‘Q1428000281’ (from row 6) is a mistake, and It should be ‘Q1428281’.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement