从liquibase changelog调用oracle过程时出错

时间:2019-07-16 12:04:50

标签: liquibase

我在数据库中创建了一个程序L_GRANT,如下所示

CREATE OR REPLACE
PROCEDURE L_GRANT (P_TABLE_NAME VARCHAR2) AS
BEGIN
  EXECUTE IMMEDIATE 'GRANT INSERT, UPDATE, DELETE, SELECT ON ' || P_TABLE_NAME || ' TO <USERSCHEMANAME>';
  EXECUTE IMMEDIATE 'GRANT SELECT ON ' || P_TABLE_NAME || ' TO <VIEWSCHEMANAME>
END; 

同一个即时消息正试图从如下所示的liquibase changelog进行调用,并因相同而出错。

<changeSet author="name" id="id1" dbms="oracle"> <sql> EXEC L_GRANT('DUMMY_TABLE') </sql> </changeSet> 

错误


 Reason: liquibase.exception.DatabaseException: ORA-00900: invalid SQL statement
 [Failed SQL: EXEC L_GRANT('DUMMY_TABLE')]
    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:619)
    at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
    at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:79)
    at liquibase.Liquibase.update(Liquibase.java:214)
    at liquibase.Liquibase.update(Liquibase.java:192)
    at liquibase.integration.commandline.Main.doMigration(Main.java:1130)
    at liquibase.integration.commandline.Main.run(Main.java:188)
    at liquibase.integration.commandline.Main.main(Main.java:103)
Caused by: liquibase.exception.DatabaseException: ORA-00900: invalid SQL statement

请建议我在这里缺少什么...

1 个答案:

答案 0 :(得分:0)

CALL代替了EXEC语句。