PL/SQL procedure to load CSV file into database table
I have a control file and a CSV file. I need help writing a PL/SQL procedure which can load the Excel file into the database table specified in the control file.
I have a control file and a CSV file, and now I have a form where I can browse these two files and on submission of this form I want to write a PL/SQL procedure which can actually perform the action of a SQL Loader and then load that Excel file into the database table specified in the control file.
Actually I can do that from the command prompt like this: c:sqlldr username/password control="control file path"
I want the process for how I can execute this command using a PL/SQL procedure. Thanks in advance.
If you are using Oracle 10g, you can use sys.DBMS_SCHEDULER. The script below shows an example of how to set up a dbms_scheduler to execute the command '/app/oracle/x.sh':
BEGIN dbms_scheduler.create_job(job_name => 'myjob', job_type => 'executable', job_action => '/app/oracle/x.sh', enabled => TRUE, auto_drop => TRUE); END; / exec dbms_scheduler.run_job('myjob');