I have a table:
id| name | organisation_name|flag |priority|salary
1 | Mark | organisation 1 |null |1 |100.00
2 | Inna | organisation 1 |null |2 |400.00
3 | Marry| organisation 1 |null |3 |500.00
4 | null | organisation 1 |250.00|null |null
5 | Grey | organisation 2 |null |1 |600.00
6 | Holly| organisation 2 |null |2 |400.00
8 | null | organisation 2 |150.00|null
The procedure should deduct the flag from the salary of a particular organization by priority. The result for this above is below. Result:
id| name | organisation_name|flag |priority|salary
1 | Mark | organisation 1 |null |1 |0.00
2 | Inna | organisation 1 |null |2 |250.00
3 | Marry| organisation 1 |null |3 |500.00
4 | null | organisation 1 |250.00|null |null
5 | Grey | organisation 2 |null |1 |450.00
6 | Holly| organisation 2 |null |2 |400.00
8 | null | organisation 2 |150.00|null
I created Pl/sql block for this, but is so slow on one million records. What is the fastest way to do this?