I think the problem is that the oracle JDBC driver does not have all the capabilities of sqlplus. You will probably need to use the execute shell command (http://www.liquibase.org/manual/execute_shell_command) tag to call sqlplus and pass it the sql to run. Otherwise, you will have to convert your legacy file from being sqlplus command specific to something the oracle jdbc driver can understand.
Nathan -----Original Message----- From: alided [mailto:[email protected]] Sent: Tuesday, May 12, 2009 6:35 PM To: [email protected] Subject: [Liquibase-user] Invoking sql script from another sql script - is it supported ? Hi, I have legacy sql scripts which invoke another sql scripts, i want to be able to run main sql from liquibase which in it's turn will run other sqls. It fails for me with oracle error. Here is my setup: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd"> <changeSet id="10" author="myname"> <sqlFile path="test_run_sql.sql" stripComments="false" splitStatements="true" endDelimiter=";"/> </changeSet> </databaseChangeLog> test_run_sql.sql @dual.sql; dual.sql select 1 from dual; All the files located in the same directory, liquibase can find them. I tried to use splitStatements="false" with the same results... Any help is highly appreciated. The error which i see in the log is : May 12, 2009 4:04:08 PM liquibase.database.template.JdbcTemplate comment INFO: Lock Database May 12, 2009 4:04:08 PM liquibase.lock.LockHandler acquireLock INFO: Successfully acquired change log lock May 12, 2009 4:06:09 PM liquibase.change.SQLFileChange setUp FINE: SQLFile file:test_run_sql.sql May 12, 2009 4:06:09 PM liquibase.change.SQLFileChange setUp FINER: SQLFile file contents is:-- run_all_db.sql -- -- Generated: Tue Apr 28 02:50:17 PDT 2009 -- @dual.sql; May 12, 2009 4:06:09 PM liquibase.database.AbstractDatabase getRanChangeSetList INFO: Reading from DATABASECHANGELOG May 12, 2009 4:06:09 PM liquibase.change.SQLFileChange setUp FINE: SQLFile file:test_run_sql.sql May 12, 2009 4:06:09 PM liquibase.change.SQLFileChange setUp FINER: SQLFile file contents is:-- run_all_db.sql -- -- Generated: Tue Apr 28 02:50:17 PDT 2009 -- @dual.sql; May 12, 2009 4:06:09 PM liquibase.parser.visitor.UpdateVisitor visit FINER: Running Changeset:install.xml::10::ALIK::(MD5Sum: e0a96513cf432aa1fe1d3980db40f0) May 12, 2009 4:06:09 PM liquibase.database.template.JdbcTemplate comment INFO: Changeset install.xml::10::ALIK::(MD5Sum: e0a96513cf432aa1fe1d3980db40f0) May 12, 2009 4:06:09 PM liquibase.change.SQLFileChange setUp FINE: SQLFile file:test_run_sql.sql May 12, 2009 4:06:09 PM liquibase.change.SQLFileChange setUp FINER: SQLFile file contents is:-- run_all_db.sql -- -- Generated: Tue Apr 28 02:50:17 PDT 2009 -- @dual.sql; May 12, 2009 4:06:09 PM liquibase.ChangeSet execute FINEST: Reading ChangeSet: install.xml::10::ALIK::(MD5Sum: e0a96513cf432aa1fe1d3980db40f0) May 12, 2009 4:06:09 PM liquibase.change.AbstractChange execute FINEST: Executing Statement: -- run_all_db.sql -- -- Generated: Tue Apr 28 02:50:17 PDT 2009 -- @dual.sql May 12, 2009 4:06:09 PM liquibase.database.template.JdbcTemplate comment INFO: Release Database Lock May 12, 2009 4:06:09 PM liquibase.lock.LockHandler releaseLock INFO: Successfully released change log lock May 12, 2009 4:06:09 PM liquibase.commandline.Main main SEVERE: Error executing SQL -- run_all_db.sql -- -- Generated: Tue Apr 28 02:50:17 PDT 2009 -- @dual.sql liquibase.exception.MigrationFailedException: Migration failed for change set install.xml::10::ALIK: Reason: liquibase.exception.JDBCException: Error executing SQL -- run_all_db.sql -- -- Generated: Tue Apr 28 02:50:17 PDT 2009 -- @dual.sql: Caused By: Error executing SQL -- run_all_db.sql -- -- Generated: Tue Apr 28 02:50:17 PDT 2009 -- @dual.sql: Caused By: ORA-00900: invalid SQL statement at liquibase.ChangeSet.execute(ChangeSet.java:238) at liquibase.parser.visitor.UpdateVisitor.visit(UpdateVisitor.java:26) at liquibase.parser.ChangeLogIterator.run(ChangeLogIterator.java:41) at liquibase.Liquibase.update(Liquibase.java:112) at liquibase.commandline.Main.doMigration(Main.java:646) at liquibase.commandline.Main.main(Main.java:95) Caused by: liquibase.exception.JDBCException: Error executing SQL -- run_all_db.sql -- -- Generated: Tue Apr 28 02:50:17 PDT 2009 -- @dual.sql at liquibase.database.template.JdbcTemplate.execute(JdbcTemplate.java:55) at liquibase.database.template.JdbcTemplate.execute(JdbcTemplate.java:86) at liquibase.change.AbstractChange.execute(AbstractChange.java:247) at liquibase.change.AbstractChange.executeStatements(AbstractChange.java:93 ) at liquibase.ChangeSet.execute(ChangeSet.java:214) ... 5 more Caused by: java.sql.SQLException: ORA-00900: invalid SQL statement at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java: 74) at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:17 1) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030) at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:183) at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:936) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement. java:1222) at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java: 1770) at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1739) at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper .java:298) at liquibase.database.template.JdbcTemplate$1ExecuteStatementCallback.doInS tatement(JdbcTemplate.java:78) at liquibase.database.template.JdbcTemplate.execute(JdbcTemplate.java:48) ... 9 more -- View this message in context: http://www.nabble.com/Invoking-sql-script-from-another-sql-script---is-i t-supported---tp23512621p23512621.html Sent from the LiquiBase - User mailing list archive at Nabble.com. ------------------------------------------------------------------------ ------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Liquibase-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/liquibase-user ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Liquibase-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/liquibase-user
