Loading Data to Multiple Tables Simultaneously
Syntax
<if_condition> ::= IF <
condition> | OTHERWISEUse
This function is only supported by the
DATALOAD command.If you want to use a single DATALOAD command to load data from one
source file 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 file you want to load into which target tables.You can only specify the
Unlike the usual DATALOAD procedure, a mass INSERT is not used for 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 file 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
surname 3
zip 5
city 6
DATALOAD TABLE partner IF POS 1 = 'p'
cno 2
surname 3
zip 5
city 6
INFILE 'address.data'
Using
IF <condition> | OTHERWISEYou want to load all data records in the
address.data source file that are neither customer addresses nor partner addresses into the prospects target file.DATALOAD TABLE customer IF POS 1 = 'k'
cno 2
surname 3
zip 5
city 6
DATALOAD TABLE partner IF POS 1 = 'p'
cno 2
surname 3
zip 5
city 6
DATALOAD TABLE prospects OTHERWISE
regno 2
surname 3
zip 5
city 6
INFILE 'address.data'