4.19 Populating Country Code

To populate the country code, follow the subsequent steps:
  1. Populate the KDD_COUNTRY table using the below query. This query will select the data from STG_COUNTRY_MASTER and insert into KDD_COUNTRY table:
    INSERT INTO kdd_country (country_id, country_cd, country_nm, country_desc) WITH country_data AS (SELECT DISTINCT v_iso_country_cd, v_country_name, v_country_desc FROM stg_country_master WHERE TO_DATE(fic_mis_date, 'DD-Mon-YY') = TO_DATE(?, 'DD-Mon-YY')) SELECT cm_geography_seq.nextval, v_iso_country_cd, v_country_name, v_country_desc FROM country_data WHERE NOT EXISTS (SELECT 1 FROM kdd_country kc WHERE kc.country_cd = country_data.v_iso_country_cd);
  2. Populate the KDD_COUNTRY_TL table using the below query. This query will select the data from STG_COUNTRY_MASTER and insert into KDD_COUNTRY_TL table:
    INSERT INTO kdd_country_tl(v_locale_cd, country_id, country_cd, country_nm, country_desc,v_source_locale)
    SELECT 'en_us',country_id,country_cd,country_nm,country_desc,'en_us' FROM kdd_country;