Importing data to several datatables with BTEQ

General
Fan

Importing data to several datatables with BTEQ

Hello,

My problem is the following :

- I use FLOAD to import data from flat files to a temporary datatable.

- Next, I want to transfer the data from the temporary table to my definitive table with BTEQ.

In the definitive table, I have a value (country name) which is repetitive, so I created a reference table (COUNTRY) where I will store the strings naming the countries.

What I want to do is to update my definitive table from the temporary table, but when the country name is not already in the COUNTRY table, insert it in that table and insert only the ID of the country from the COUNTRY table in the definitive table .

For example :

Data in the temporary table :   

123/456/"FRANCE"

222/333/"ITALY"

444/555/"SPAIN"

What I want in the COUNTRY table :

1/"ITALY"

2/"FRANCE"

3/"SPAIN"

What I want in the definitive table (last column is the ID of the country from the COUNTRY table) :

123/456/2

222/333/1

444/555/3

Is there a simple way to achieve such inserting with BTEQ ? I am a newbie with BTEQ and I really don't know how to do that.

Thank you for your help.