19.5 Populating Country ID

This section describes how to populate a Country ID.

To populate the country ID:

Populate the KDD_COUNTRYtable 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_masterWHERE 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_descFROM country_data WHERE NOT
          EXISTS (SELECT 1FROM kdd_country
          kc
    WHERE kc.country_cd = country_data.v_iso_country_cd);