在DB2上使用liquibase创建或替换视图

在DB2上使用liquibase创建或替换视图,db2,liquibase,create-view,Db2,Liquibase,Create View,我想使用liquibase及其changeSet标记在DB2上创建或替换一个视图: 这是我在changelog.xml文件中包含的内容: <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" logicalFilePath="lon-service-mpd/gin/15.100/15.10

我想使用liquibase及其changeSet标记在DB2上创建或替换一个视图:

这是我在changelog.xml文件中包含的内容:

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    logicalFilePath="lon-service-mpd/gin/15.100/15.100.0.0.changelog.xml"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

    <changeSet author="mas-gin-gestion-echelon-service" id="create-view-from-table-periodeavancement-type-personnel">
        <createView schemaName="GIN" viewName="V_PERIODEAVANCEMENT_1">select IDPERIODE, CAMPAGNETA from GIN.PERIODEAVANCEMENT</createView>
    </changeSet>

</databaseChangeLog>

从GIN.PERIODEAVANCE中选择IDPERIODE、CAMPAGNETA
但是,在创建视图期间,DB2返回以下错误


即使SQL语法正确,我也找不到解决问题的方法。

我通过直接调用SQL文件而不是使用。以下是我的解决方案:

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
logicalFilePath="mas-gin-gestion-echelon-service-mpd/gin/15.100/15.100.0.0.changelog.xml"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
    http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

<changeSet id="create_view_periodeavancement" author="mas-gin-gestion-echelon-service">
    <sqlFile path="sql/create_view_periodeavancement.sql" relativeToChangelogFile="true"/>
</changeSet>

我通过直接调用sql文件而不是使用。以下是我的解决方案:

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
logicalFilePath="mas-gin-gestion-echelon-service-mpd/gin/15.100/15.100.0.0.changelog.xml"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
    http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

<changeSet id="create_view_periodeavancement" author="mas-gin-gestion-echelon-service">
    <sqlFile path="sql/create_view_periodeavancement.sql" relativeToChangelogFile="true"/>
</changeSet>

您确定查询中的列正常吗?是的,我只是在阅读您的评论时验证了这一点,然后尝试使用updateSQL命令验证脚本的输出。您确定查询中的列正常吗?是的,我只是在阅读您的评论时验证了这一点,然后尝试使用updateSQL命令验证脚本的输出。