1

I have a files containing sql scripts both DDL and DML scripts like create, insert, update, delete, create views etc.

i need to split them correctly an execute them, any suggestions..

thanks in advance

3
  • That is quite a vague question... Commented Aug 13, 2012 at 13:35
  • what format will the file containing the SQL scripts have? i.e. will you have one SQL statement per line, or could SQL statements be spread over multiple lines? Or are comments allowed in the SQL script file? Commented Aug 13, 2012 at 14:39
  • sql statements in multiple line eg. formatted sql queries with more than 30 lines like views, and the file will also contains the commented lines Commented Aug 13, 2012 at 14:45

1 Answer 1

-1

eventually duplicated question: Split multiple SQL statements into individual SQL statements

To execute you could use something like:

Statement stmt = conn.createStatement();
for(String statement : statements) {
    stmt.addBatch(statement);
}
stmt.executeBatch();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.