liquibase.exception.DatabaseException:ORA-00933:SQL命令未正确结束

时间:2016-02-24 12:13:27

标签: java oracle groovy liquibase

Toad for Oracle中运行时,oracle命令可以正常工作。

当我尝试将以下代码段部署到服务器时,出现SQL command not properly ended错误。

以下是错误:

Reason: liquibase.exception.DatabaseException: 
    Error executing SQL GRANT EXECUTE ON SPT_ADD_SI_EVENT_RECIPIENT 
    TO PROJECT_SUPPORT_RW, APPSUPPORT_RW, PROJECT_ANALYST_RW, DB_DATASUPPORT_RW;
    : ORA-00933: SQL command not properly ended

CODE:

CREATE OR REPLACE PROCEDURE SPT_ADD_SI_EVENT_RECIPIENT (eventName IN VARCHAR2, emailAddresses IN VARCHAR2) IS
     nExists int;
BEGIN
    select count(*) into nExists from SI_RECIPIENT where event = eventName;
    if nExists = 1 then
        UPDATE SI_RECIPIENT
        SET email = emailAddresses
        WHERE event = eventName;
    else
        INSERT INTO SI_RECIPIENT(event,email) VALUES (eventName,emailAddresses);
    end if;
END SPT_ADD_SI_EVENT_RECIPIENT;
/
GRANT EXECUTE ON SPT_ADD_SI_EVENT_RECIPIENT TO PROJECT_SUPPORT_RW, APPSUPPORT_RW, PROJECT_ANALYST_RW, DB_DATASUPPORT_RW;

LOG:

[groovy]    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:61)

[groovy]    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:106)

[groovy]    at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1189)

[groovy]    at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1172)

[groovy]    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:352)

[groovy]    at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:40)

[groovy]    at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:64)

[groovy]    at liquibase.Liquibase.update(Liquibase.java:202)

[groovy]    at liquibase.Liquibase.update(Liquibase.java:181)

[groovy]    at liquibase.integration.ant.DatabaseUpdateTask.executeWithLiquibaseClassloader(DatabaseUpdateTask.java:45)

[groovy]    at liquibase.integration.ant.BaseLiquibaseTask.execute(BaseLiquibaseTask.java:71)

[groovy]    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)

[groovy]    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)

[groovy]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

[groovy]    at java.lang.reflect.Method.invoke(Method.java:597)

[groovy]    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

[groovy]    at org.apache.tools.ant.Task.perform(Task.java:348)

[groovy]    at org.apache.tools.ant.Target.execute(Target.java:357)

[groovy]    at org.apache.tools.ant.Target.performTasks(Target.java:385)

[groovy]    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)

[groovy]    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)

[groovy]    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)

[groovy]    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)

[groovy]    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)

[groovy]    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)

[groovy]    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)

[groovy]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

[groovy]    at java.lang.reflect.Method.invoke(Method.java:597)

[groovy]    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

[groovy]    at org.apache.tools.ant.Task.perform(Task.java:348)

[groovy]    at org.apache.tools.ant.Target.execute(Target.java:357)

[groovy]    at org.apache.tools.ant.Target.performTasks(Target.java:385)

[groovy]    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)

[groovy]    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)

[groovy]    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)

[groovy]    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)

[groovy]    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)

[groovy]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[groovy]    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

[groovy]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

[groovy]    at java.lang.reflect.Method.invoke(Method.java:597)

[groovy]    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)

[groovy]    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)

[groovy]    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:121)

[groovy]    at embedded_script_in__repositories_tools_ant_gradle_wsql_dot_build_dot_xml.run(embedded_script_in__repositories_tools_ant_gradle_wsql_dot_build_dot_xml:112)

[groovy]    at org.codehaus.groovy.ant.Groovy.parseAndRunScript(Groovy.java:425)

[groovy]    at org.codehaus.groovy.ant.Groovy.execGroovy(Groovy.java:404)

[groovy]    at org.codehaus.groovy.ant.Groovy.execute(Groovy.java:279)

[groovy]    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)

[groovy]    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)

[groovy]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

[groovy]    at java.lang.reflect.Method.invoke(Method.java:597)

[groovy]    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

[groovy]    at org.apache.tools.ant.Task.perform(Task.java:348)

[groovy]    at org.apache.tools.ant.Target.execute(Target.java:357)

[groovy]    at org.apache.tools.ant.Target.performTasks(Target.java:385)

[groovy]    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)

[groovy]    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)

[groovy]    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)

[groovy]    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)

[groovy]    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)

[groovy]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[groovy]    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

[groovy]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

[groovy]    at java.lang.reflect.Method.invoke(Method.java:597)

[groovy]    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)

[groovy]    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)

[groovy]    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)

[groovy]    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)

[groovy]    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:121)

[groovy]    at embedded_script_in__repositories_tools_ant_gradle_wsql_dot_build_dot_xml.run(embedded_script_in__repositories_tools_ant_gradle_wsql_dot_build_dot_xml:9)

[groovy]    at org.codehaus.groovy.ant.Groovy.parseAndRunScript(Groovy.java:425)

[groovy]    at org.codehaus.groovy.ant.Groovy.execGroovy(Groovy.java:404)

[groovy]    at org.codehaus.groovy.ant.Groovy.execute(Groovy.java:279)

[groovy]    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)

[groovy]    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)

[groovy]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

[groovy]    at java.lang.reflect.Method.invoke(Method.java:597)

[groovy]    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

[groovy]    at org.apache.tools.ant.Task.perform(Task.java:348)

[groovy]    at org.apache.tools.ant.Target.execute(Target.java:357)

[groovy]    at org.apache.tools.ant.Target.performTasks(Target.java:385)

[groovy]    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)

[groovy]    at org.apache.tools.ant.Project.executeTarget(Project.java:1306)

[groovy]    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)

[groovy]    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)

[groovy]    at org.apache.tools.ant.Main.runBuild(Main.java:758)

[groovy]    at org.apache.tools.ant.Main.startAnt(Main.java:217)

[groovy]    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)

[groovy]    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

[groovy] Caused by: java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

[groovy] 

[groovy]    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)

[groovy]    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)

[groovy]    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)

[groovy]    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)

[groovy]    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)

[groovy]    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)

[groovy]    at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:195)

[groovy]    at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1036)

[groovy]    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)

[groovy]    at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1916)

[groovy]    at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1878)

[groovy]    at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:318)

[groovy]    at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:294)

[groovy]    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:54)

[groovy]    ... 89 more

[groovy] INFO 2/24/16 12:47 PM:liquibase: /tmp/java_build/DRUG_T0075016/Template/DRUG_T0075016/sql_tmp/db.changelog-standard.2.xml::2::system: Successfully released change log lock

BUILD FAILED

/repositories/tools/ant/gradle_wsql.build.xml:471: The following error occurred while executing this line:

/repositories/tools/ant/gradle_wsql.build.xml:497: The following error occurred while executing this line:

/repositories/tools/ant/gradle_wsql.build.xml:673: The following error occurred while executing this line:

/repositories/tools/ant/gradle_wsql.build.xml:694: liquibase.exception.MigrationFailedException: Migration failed for change set /tmp/java_build/DRUG_T0075016/Template/DRUG_T0075016/sql_tmp/db.changelog-standard.2.xml::2::system:

 Reason: liquibase.exception.DatabaseException: Error executing SQL GRANT EXECUTE ON SPT_ADD_SI_EVENT_RECIPIENT TO PROJECT_SUPPORT_RW, APPSUPPORT_RW, PROJECT_ANALYST_RW, DB_DATASUPPORT_RW;: ORA-00933: SQL command not properly ended

1 个答案:

答案 0 :(得分:0)

这里有一个很好的问题描述: http://forum.liquibase.org/topic/formatted-sql-enddelimiter-issue

我建议删除“/”以查看是否有效。