tags:

views:

1099

answers:

1

We currently run a specific SQL script as part of our ANT deploy process.

What we'd like to do is change this so we run all SQL scripts in a given directory. We can't figure out how to get this directory listing in ANT and iterate through the list and run each SQL script. Does anyone know how to do this?

Note: we currently run the sql file by using the ant exec task that runs "call sqlplus ${id}/${pw}@${db.instance} @${file}"

Thanks

+4  A: 

I would recommend using the SQL task. You can then specify with the follo9wing:

<sql
    driver="org.database.jdbcDriver"
    url="jdbc:database-url"
    userid="sa"
    password="pass">
  <path>
    <fileset dir=".">
      <include name="data*.sql"/>
    </fileset>
  <path>
</sql>
Rob Di Marco
Be aware, the ant sql task 'chokes' on function declarations.I dont yet know how to work around this.
NSherwin