
-- update CU_MEMBER set GLOBAL_CODE=null

--update CU_MEMBER set COUNTRY_CODE=null



-- 更新国际编号
update CU_MEMBER set GLOBAL_CODE = 'GB' ||LPAD((pk_id + 10000), 8, '0');


-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 1
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'CHN' || LPAD((b.orders + 10000), 8, '0');



-- 更新表中的数据
merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 2
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'USA' || LPAD((b.orders + 10000), 8, '0');



-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 17
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'MAS' || LPAD((b.orders + 10000), 8, '0');




-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 18
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'BAN' || LPAD((b.orders + 10000), 8, '0');


-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 19
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'MGL' || LPAD((b.orders + 10000), 8, '0');



-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 20
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'KAZ' || LPAD((b.orders + 10000), 8, '0');



-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 21
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'INA' || LPAD((b.orders + 10000), 8, '0');




-- 更新表中的数据


merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 22
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'CAN' || LPAD((b.orders + 10000), 8, '0');




-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 23
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'PHI' || LPAD((b.orders + 10000), 8, '0');





-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 24
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'VIE' || LPAD((b.orders + 10000), 8, '0');





-- 更新表中的数据
merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 25
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'GHA' || LPAD((b.orders + 10000), 8, '0');




-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 26
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'COD' || LPAD((b.orders + 10000), 8, '0');



-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 27
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'CMR' || LPAD((b.orders + 10000), 8, '0');




-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 28
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'CIV' || LPAD((b.orders + 10000), 8, '0');





-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 29
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'BEN' || LPAD((b.orders + 10000), 8, '0');





-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 30
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'KEN' || LPAD((b.orders + 10000), 8, '0');





-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 31
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'MTN' || LPAD((b.orders + 10000), 8, '0');




-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 105
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'NGR' || LPAD((b.orders + 10000), 8, '0');



-- 更新表中的数据

merge into CU_MEMBER a
using (
 select rownum orders,pk_id from (
 select pk_id,member_code from cu_member
 where PK_SETTLE_COUNTRY = 106
 order by pk_id ))b
 on (a.pk_id = b.pk_id)
 when matched then
  UPDATE SET a.COUNTRY_CODE = 'TOG' || LPAD((b.orders + 10000), 8, '0');

