问题
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 , - Then open you
sql developer
.Create a file calledbatch.sql
in your Batch_Files folder . 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