Update table column based in value occurrence
Content
I want to update table A column item_number on basis of table B for all rows that appear till item_location:'GRAND TOTAL:' occurrence in the column.
Please check the below tables for more clarity and help me to build this logic in oracle db.
Table B
Item_number |
ZC-M3 |
RC-4-2 |
RC-4-2 |
Table A
order_number | Business_Unit | QTY_AVAILABLE | ITEM_LOCATION | LOT_SERIAL | Item_number | record_id |
1953454 | 111001 | 22585 | 6007.104.007 | 1850206 | null | 10756117 |
1953454 | 111001 | 68420 | 6007.104.009 | 1850210 | null | 10756118 |
1953454 | 111001 | -103000 | COMP.ONE.NTS | null | 10756119 | |
1953454 | 111001 | -11995 | TOTAL: | null | null | 10756120 |
1953454 | 111001 | -11995 | GRAND TOTAL: | null | null | 10756121 |
1953454 | 111001 | 38860 | 6005.101.007 | 1875163 | null | 10756122 |
1953454 | 111001 | 40000 | 6005.101.009 | 1875163 | null | 10756123 |
1953454 | 111001 | 14060 | 6005.102.005 | 1875164 | null | 10756124 |
1953454 | 111001 | 60000 | 6005.103.009 | 1875162 | null | 10756125 |
1953454 | 111001 | 1540 | 6005.106.007 | 1677779 | null | 10756126 |
1953454 | 111001 | -137500 | COMP.ONE.NTS | null | 10756127 | |
1953454 | 111001 | 16960 | TOTAL: | null | null | 10756128 |
1953454 | 111001 | 16960 | GRAND TOTAL: |
Tagged:
0