Auto run/schedule multiple scripts and (auto) export the outputs into CSV/Excel

146 Views Asked by At

Is there a way to execute or schedule multiple scripts in Toad 11g and also export the data into CSV or excel without having to it manually or one script at a time?

1

There are 1 best solutions below

0
On

One option would be this:

  • create a stored procedure (or procedures) which will extract data you need
  • that procedure would utilize UTL_FILE package
  • it means that you'll also need to have a directory (Oracle object which points to a directory on database server) and acquire read/write privileges on it
  • make sure that procedure returns desired result - don't forget to separate columns by a semi-colon so that such a CSV file is readable by MS Excel
  • then create database job (using DBMS_JOB (simpler) or DBMS_SCHEDULER (more advanced)) which will call that procedure in a scheduled manner (for example, every day at 02:30)
  • next morning, pick up created CSV file(s) and do whatever you plan to do with it/them