Home > Net >  Need to load the excel data to database table on weekly basis automatically
Need to load the excel data to database table on weekly basis automatically

Time:11-17

create table LOADER_TAB (
    i_id,
    i_name,
    risk
);

csv file :

portal,,
ex portal,,
,,
i_id,i_name,risk
1,a,aa
2,b,bb
3,c,cc
4,d,dd
5,e,ee
6,f,ff
7,g,gg
8,h,hh
9,i,ii
10,j,jj

I need to load the excel data to a database table on weekly basis. Currently, I am doing using SQL Loader every time. But is there any other way to automate it? I need to load the data every Monday into the table. I am wondering if this can be done with dbms_scheduler? How I will be able to load the data into the table automatically when I load the excel in the folder on weekly basis ?

CodePudding user response:

If you want to keep using SQL*Loader, then you probably wouldn't use DBMS_SCHEDULER (although it is capable of running operating system level scripts) - you'd use operating system scheduling application (such as Task Scheduler on MS Windows).

Therefore (if on Windows):

  • Create a batch script (.bat) which would ...
  • ... run sqlldr.exe which ...
  • ... uses your current control file and loads data into the table.
  • Using Task Scheduler, schedule the .bat script to run on Mondays at desired time
  • Related