Loading Data to Multiple Tables Simultaneously 
The
DATALOAD command supports loading multiple tables simultaneously.Syntax
<if_condition> ::= IF <
condition> | OTHERWISEUse
If you want to use a single DATALOAD command to load data from one
source data stream into multiple tables simultaneously, you must describe each of these target tables with a separate DATALOAD specification. Use selection criteria to define which records in the source data stream you want to load into which target tables.
You can only specify the
Unlike the usual DATALOAD command, a mass INSERT is not used for loading into multiple target tables. Instead, the data records are transferred to the target tables individually from the data file. This affects the performance of the load procedure.
Using
IF <condition>
You want to load those data records in the
address.data source data stream that begin with the letter k to the target table with the name customer and all those data records that begin with the letter p to the target table with the name partner:DATALOAD TABLE customer IF POS 1 = 'k'
cno 2
name 3
zip 5
city 6
DATALOAD TABLE partner IF POS 1 = 'p'
cno 2
name 3
zip 5
city 6
INFILE 'address.data'
Using
IF <condition> | OTHERWISE
You want to load all data records in the
address.data source data stream that are neither customer addresses nor partner addresses into the prospects target table.DATALOAD TABLE customer IF POS 1 = 'k'
cno 2
name 3
zip 5
city 6
DATALOAD TABLE partner IF POS 1 = 'p'
cno 2
name 3
zip 5
city 6
DATALOAD TABLE prospects OTHERWISE
regno 2
name 3
zip 5
city 6
INFILE 'address.data'