Oracle SQL Developer how to dynamicly run sql scripts

与世无争的帅哥 提交于 2019-12-08 14:01:43

问题


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:


  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 .



来源:https://stackoverflow.com/questions/13137258/oracle-sql-developer-how-to-dynamicly-run-sql-scripts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!