简体   繁体   中英

Oracle SQL Developer how to dynamicly run sql scripts

I have the following challange;

I would like to execute a batch of *.sql files on one database. The sql files are assumed to be named in ascending order of their execution sequence. So the main sql script should do a 'dir /s *.sql', then start each of the found scripts in order.

Is this possible ?

Below is something I found for SQL Server, but I want something similar for Oracle SQL Developer.

http://pradeep1210.wordpress.com/2012/03/15/executing-a-set-of-sql-script-files-sql-on-a-group-of-sql-server-databases/

Thanks in advance.

Raymond

  1. Create a folder for eg: Batch_Files in you local machine ,which will contain all the sql script that you want to execute ,
  2. Then open you sql developer .Create a file called batch.sql in your Batch_Files folder .
  3. In Batch.sql add the sql files that you want to execute in sequence.

    @file1.sql

    @file2.sql :

    :

    @fileN.sql

These files contains the code that you need to run in sequence .This is a very basic example.You can do various changes according to your need ,you can add anonymous block to print something after execution of files .I have not tested this is SQL-DEVELOPER ,but i think this will surely work for you .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM