gpt4 book ai didi

sql - 运行 liquibase 脚本时出现无效字符

转载 作者:行者123 更新时间:2023-12-04 17:22:17 29 4
gpt4 key购买 nike

当我在 Sql Developer 中运行下面的脚本时,它正确地创建了我的全局临时表,但是当我运行 liquibase 脚本时,它由于“无效字符”而失败。有谁知道为什么这会失败?

在 Sql Developer (作品)

 CREATE GLOBAL TEMPORARY TABLE TransactionsToMove(
TransactionId NUMBER(38,0) NOT NULL,
PRIMARY KEY (TransactionId))
ON COMMIT DELETE ROWS;

Liquibase xml (以下堆栈跟踪失败)
<changeSet id="createGlobalTemporaryTableForTransactionsMove" author="me" >
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="TransactionsToMove"/>
</not>
</preConditions>
<sql splitStatements="false" endDelimiter=";"><![CDATA[
CREATE GLOBAL TEMPORARY TABLE TransactionsToMove(
TransactionId NUMBER(38,0) NOT NULL,
PRIMARY KEY (TransactionId))
ON COMMIT DELETE ROWS;
]]>
</sql>
</changeSet>

堆栈跟踪
    SEVERE 2013-11-14 09:10:liquibase: Error executing SQL CREATE GLOBAL TEMPORARY TABLE TransactionsToMove(
TransactionId NUMBER(38,0) NOT NULL,
PRIMARY KEY (TransactionId))
ON COMMIT DELETE ROWS;
java.sql.SQLSyntaxErrorException: ORA-00911: invalid character

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1033)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1909)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1871)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:318)
at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:105)
at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1014)
at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:998)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
at liquibase.Liquibase.update(Liquibase.java:113)
at se.mypackage.exbo.database.liquibase.LiquibaseDatabaseManager.runChangelog(LiquibaseDatabaseManager.java:177)
at se.mypackage.exbo.database.liquibase.LiquibaseDatabaseManager.create(LiquibaseDatabaseManager.java:145)
at se.mypackage.exbo.database.DatabaseManager.dropAndCreate(DatabaseManager.java:349)
at se.mypackage.exbo.database.DatabaseManager.main(DatabaseManager.java:720)
SEVERE 2013-11-14 09:10:liquibase: Change Set db/scripts/movetohistorical-oracleserver.xml::createGlobalTemporaryTableForTransactionsMove::marbe failed. Error: Error executing SQL CREATE GLOBAL TEMPORARY TABLE TransactionsToMove(
TransactionId NUMBER(38,0) NOT NULL,
PRIMARY KEY (TransactionId))
ON COMMIT DELETE ROWS;: ORA-00911: invalid character

liquibase.exception.DatabaseException: Error executing SQL CREATE GLOBAL TEMPORARY TABLE TransactionsToMove(
TransactionId NUMBER(38,0) NOT NULL,
PRIMARY KEY (TransactionId))
ON COMMIT DELETE ROWS;: ORA-00911: invalid character

at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:105)
at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1014)
at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:998)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
at liquibase.Liquibase.update(Liquibase.java:113)
at se.mypackage.exbo.database.liquibase.LiquibaseDatabaseManager.runChangelog(LiquibaseDatabaseManager.java:177)
at se.mypackage.exbo.database.liquibase.LiquibaseDatabaseManager.create(LiquibaseDatabaseManager.java:145)
at se.mypackage.exbo.database.DatabaseManager.dropAndCreate(DatabaseManager.java:349)
at se.mypackage.exbo.database.DatabaseManager.main(DatabaseManager.java:720)
Caused by: java.sql.SQLSyntaxErrorException: ORA-00911: invalid character

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1033)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1909)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1871)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:318)
at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
... 11 more
INFO 2013-11-14 09:10:liquibase: Successfully released change log lock
Exception in thread "main" se.mypackage.exbo.database.DatabaseManagerException: Liquibase changelog update failed using changelog: db-main-create-13.4.xml, reason: Migration failed for change set db/scripts/movetohistorical-oraclese
Reason: liquibase.exception.DatabaseException: Error executing SQL CREATE GLOBAL TEMPORARY TABLE TransactionsToMove(
TransactionId NUMBER(38,0) NOT NULL,
PRIMARY KEY (TransactionId))
ON COMMIT DELETE ROWS;: ORA-00911: invalid character
:
Caused By: Error executing SQL CREATE GLOBAL TEMPORARY TABLE TransactionsToMove(
TransactionId NUMBER(38,0) NOT NULL,
PRIMARY KEY (TransactionId))
ON COMMIT DELETE ROWS;: ORA-00911: invalid character
:
Caused By: ORA-00911: invalid character

at se.mypackage.exbo.database.liquibase.LiquibaseDatabaseManager.runChangelog(LiquibaseDatabaseManager.java:180)
at se.mypackage.exbo.database.liquibase.LiquibaseDatabaseManager.create(LiquibaseDatabaseManager.java:145)
at se.mypackage.exbo.database.DatabaseManager.dropAndCreate(DatabaseManager.java:349)
at se.mypackage.exbo.database.DatabaseManager.main(DatabaseManager.java:720)
Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set db/scripts/movetohistorical-oracleserver.xml::createGlobalTemporaryTableForTransactionsMove::marbe:
Reason: liquibase.exception.DatabaseException: Error executing SQL CREATE GLOBAL TEMPORARY TABLE TransactionsToMove(
TransactionId NUMBER(38,0) NOT NULL,
PRIMARY KEY (TransactionId))
ON COMMIT DELETE ROWS;: ORA-00911: invalid character
:
Caused By: Error executing SQL CREATE GLOBAL TEMPORARY TABLE TransactionsToMove(
TransactionId NUMBER(38,0) NOT NULL,
PRIMARY KEY (TransactionId))
ON COMMIT DELETE ROWS;: ORA-00911: invalid character
:
Caused By: ORA-00911: invalid character

at liquibase.changelog.ChangeSet.execute(ChangeSet.java:347)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
at liquibase.Liquibase.update(Liquibase.java:113)
at se.mypackage.exbo.database.liquibase.LiquibaseDatabaseManager.runChangelog(LiquibaseDatabaseManager.java:177)
... 3 more
Caused by: liquibase.exception.DatabaseException: Error executing SQL CREATE GLOBAL TEMPORARY TABLE TransactionsToMove(
TransactionId NUMBER(38,0) NOT NULL,
PRIMARY KEY (TransactionId))
ON COMMIT DELETE ROWS;: ORA-00911: invalid character

at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:105)
at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1014)
at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:998)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
... 7 more
Caused by: java.sql.SQLSyntaxErrorException: ORA-00911: invalid character

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1033)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1909)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1871)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:318)
at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
... 11 more

最佳答案

分号是在客户端应用程序(如 Oracle SQL*Plus)中使用的命令终止符。

通过 Prepared Statement 或类似技术调用 db 命令时通常不需要 is。

关于sql - 运行 liquibase 脚本时出现无效字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19972899/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com