Hi, I have a large table (~1.000.000rows) with data as the following
with tmp(code, cmp_id, quantity, price, t_date) as (
select '2342342' , 361, 1, 234.23, to_date('01/04/2021','dd/mm/yyyy') from dual union all
select '2342342' , 361, 3, 15.23, to_date('04/04/2021','dd/mm/yyyy') from dual union all
select '2342342' , 361, 2, 11.23, to_date('14/04/2021','dd/mm/yyyy') from dual union all
select '2342342' , 361, 1, 25.23, to_date('21/04/2021','dd/mm/yyyy') from dual union all
select '2342342' , 361, 3, 15.23, to_date('29/04/2021','dd/mm/yyyy') from dual
)
select *
from tmp;
I want to update the cmp_id random so as the new cmp_id (will be 500) to have the 70% of summary quantity and the rest to be assigned in 361 (as it is)
Example result
select '2342342' , 500, 1, 234.23, to\_date('01/04/2021','dd/mm/yyyy') from dual union all
select '2342342' , 500, 3, 15.23, to\_date('04/04/2021','dd/mm/yyyy') from dual union all
select '2342342' , 361, 2, 11.23, to\_date('14/04/2021','dd/mm/yyyy') from dual union all
select '2342342' , 361, 1, 25.23, to\_date('21/04/2021','dd/mm/yyyy') from dual union all
select '2342342' , 500, 3, 15.23, to\_date('29/04/2021','dd/mm/yyyy') from dual
Could you help me please ?