使用liquibase执行oracle过程时出错

时间:2019-10-22 09:49:55

标签: sql oracle oracle11g liquibase

我正在尝试使用liquibase运行以下内容

--liquibase formatted sql

--changeset id:1
DECLARE str varchar(30);
BEGIN
    str := 'something';
    update table_name set comment = str where id=1; 
END;

但是出现以下错误。该如何解决?

[ERROR]      Reason: liquibase.exception.DatabaseException: ORA-06550: line 1, column 23:
[ERROR] PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
[ERROR] 
[ERROR]    := ; not null default character
[ERROR]  [Failed SQL: DECLARE str varchar(30)]

如果我删除“;”经过DECLARE并执行后,出现以下错误

[ERROR] PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:
[ERROR] 
[ERROR]    := ; not null default character
[ERROR] The symbol ";" was substituted for "BEGIN" to continue.
[ERROR] ORA-06550: line 3, column 16:
[ERROR] PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
[ERROR] 
[ERROR]    * & = - + ; < / > at in is mod remainder not rem
[ERROR]    <an exponent (**)> <> or != or ~= >= <= <> and or like like2
[ERROR]    like4 likec between || multiset m
[ERROR]  [Failed SQL: DECLARE str varchar(30)
[ERROR] BEGIN
[ERROR]     str := 'something']

编辑:

在评论帮助中,我的问题通过在末尾添加“ /”得到解决

--liquibase formatted sql

--changeset id:1
DECLARE str varchar(30);
BEGIN
    str := 'something';
    update table_name set comment = str where id=1; 
END;
/

0 个答案:

没有答案