Press "Enter" to skip to content

SQL Loader Control File WHEN Clause Example

In SQL Loader Control File, you can use WHEN clause to tell SQL Loader to load the data only when the condition is true. Also, you can use the WHEN clause to load data into multiple tables. Below is an example.

SQL Loader Control File WHEN Clause Example

LOAD DATA
APPEND
INTO TABLE JOB_HISTORY_10
when DEPARTMENT_ID = '10'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(
EMPLOYEE_ID,
START_DATE,
END_DATE,
JOB_ID, 
DEPARTMENT_ID
)
INTO TABLE JOB_HISTORY_20
when DEPARTMENT_ID = '20'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(
EMPLOYEE_ID,
START_DATE,
END_DATE,
JOB_ID, 
DEPARTMENT_ID
)

See also:

Vinish Kapoor

Hi, I am a full stack developer and writing about development. I document everything I learn and help thousands of people. foxinfotech.in is created, written, and maintained by me; it is built on WordPress, and hosted by Bluehost. Connect with me on Facebook, Twitter, GitHub, and get notifications for new posts.

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *