开发者

Liquibase - uploading many Oracle triggers in one file

I have a number of Oracle triggers stored in a file which we upload to our DB using sqlplus. We want to use liquibase instead to manage this, but I don't really want to split out the triggers into separate files. The file looks like:

开发者_如何学编程
  create or replace trigger Trig1 ...
  ...
  end Trig1;
  /
  create or replace trigger Trig2 ...
  ...
  end Trig2;
  /
  ...etc.

I've tried

<sqlFile splitStatements="true" endDelimiter="/" path="triggers.sql">

but it still seems to be trying to split on ';'. If I change splitStatements to false. it then ignores the '/' and includes everything as an invalid single trigger. Any ideas?

TIA.


I realize this is an old issue and OP has moved on, but for anyone else I ended up finding the answer here: http://forum.liquibase.org/topic/oracle-end-delimiter-issue.

It turns out "endDelimiter" is a regular expression -- this string should be used:

\n/\s*\n|\n/\s*$


I recently got this issue. endDelimiter should be:

endDelimiter="(?m)^/$"


I have a similar problem with Oracle 11g and Liquibase. I get an ORA-00911. In my db-changelog.xml I point to a sql file where I have triggers. This does not work at all. I have tested the things you said above with /\;

CREATE OR REPLACE TRIGGER ADRESSE_ID_TR 
            BEFORE INSERT ON ADRESSE 
            FOR EACH ROW 
            WHEN (new.ID IS NULL) BEGIN 
            SELECT adresse_seq.NEXTVAL 
            INTO   :new.ID 
            FROM   dual; 
            END ADRESSE_ID_TR;\

My workaround is adding a in in db-changelog.xml. I don't like it because the db-changelog.xml is going to be very large and I want it in the .sql files not in db-changelog.xml.

Another problem is when I generate DDL's with tools like Oracle SQL Developer and paste them in, they don't work. A lot of sql's don't work, probably not supported. I spend a lot of time testing my SQL's and Liquibase with Eclipse to fix the SQL's. Any tips or will you fix this?


That syntax looks correct. The endDelimiter should be telling it to override the default ; delimiter and use / instead. What version of liquibase are you using? Does it help if you put the \ not by itself?

  create or replace trigger Trig1 ...
  ...
  end Trig1; /

  create or replace trigger Trig2 ...
  ...
  end Trig2; /

  ...etc.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜