如何使用 liquibase sql 格式的 set define off

how to use set define off in liquibase sql format

我有一个 HTML 文件要存储在数据库中。我正在为此使用 Liquibase,但在 HTML 中我有很多   个实例。

问题是 SQL 不允许 & 到 运行 没有 set define off 选项。

我从网上了解到以下解决方案:

Liquibase 执行错误:

SEVERE 6/7/17 11:30 AM:liquibase: Error executing SQL set define off
java.sql.SQLException: ORA-00922: missing or invalid option

    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)

我该怎么做才能解决这个问题?

Liquibase 抱怨的 set define off 不是 SQL, it is a SQL*Plus client command:

SET DEF[INE] {& | c | ON | OFF}

Sets the character used to prefix substitution variables to c.

ON or OFF controls whether SQL*Plus will scan commands for substitution variables and replace them with their values. ON changes the value of c back to the default '&', not the most recently used character. The setting of DEFINE to OFF overrides the setting of the SCAN variable.

SQL Developer and SQLcl as well. All of those clients use it to control the behaviour of substitution variables使用。

Liquibase 显然无法识别该客户端命令,因此应将其从您的脚本中删除。

作为 & 在 &(& 符号)nbsp;在 sql 中被视为替换变量并且 liquibase 忽略 set define off 语句,因此我使用 ascii 字符在 liquibase 中定义的 sql 查询中使用 & 如下:

&(& 符号)nbsp;更改为 ' || '&' || 'nbsp' || CHR(59) || ' 并且查询有效