Conditional multiple loading by SQL Loader [message #195888] |
Tue, 03 October 2006 00:24 |
attraxion
Messages: 14 Registered: October 2006
|
Junior Member |
|
|
Hi All,
I am trying to load data from flat files to multiple tables. However, the tables are related and I want that if a record is rejected while loading for one table, similar records should be rejected too.
For instance, I have two tables EMP_INFO and EMP_LEAVE in which I want to load data:
EmpID Fname Lname (EMP_INFO record)
34002 Rahul Agarwal
EmpID Casual Medical (EMP_LEAVE record)
34002 5 2
I want that if any record above fails, all records having 34002 EmpID should not be loaded.
However, I must mention that the table EMP_LEAVE does not contain records for all employees. This is the reason why I cannot arrange the flat file in a single-line structure and load in this way from CTL file:
INTO TABLE emp_info
(EmpID POSITION(1:10) CHAR,
Fname POSITION(12:22) CHAR)
INTO TABLE emp_leave
(EmpID POSITION(1:10) CHAR,
Casual POSITION(25:27) INTEGER EXTERNAL)
because for most employees leave columns would be blank. Only for those employees where leave is not blank, do I want the above conditional loading.
Any pointers much appreciated. Thanks.
Best,
Rahul.
|
|
|