Spring DataSourceInitializer splits trigger ins sql by ; delimiter -


we use org.springframework.batch.test.datasourceinitializer class in order init db on basis of .sql scripts.

init failed,after trigger had been added .sql.

after debugging,the cause of error while found here:

try { scripts = stringutils.delimitedlisttostringarray(stripcomments(ioutils.readlines(scriptresource.getinputstream())), ";"); } 

this error happened,because delimiter ";" symbol,so trigger splittet several parts on basis of ";" , treated uncorrectly.

can advise me more advanced data source initializer,that understand triggers correctly?

thank you.

the create trigger statement pl/sql block, , pl/sql blocks must terminated single / first character of row.
should work:

create or replace trigger "account_biu"    before insert or update on account    referencing old old new new    each row  begin    if (:new.eskontotype_id   null)      if (:new.kontotype_id    ='np')        :new.eskontotype_id   := 311;      elsif (:new.kontotype_id ='mt')        :new.eskontotype_id   := 320;      elsif (:new.kontotype_id ='nl')        :new.eskontotype_id   := 330;      end if;    end if;    :new.endretbruker := substr(user,1,7);    :new.endretdato   := sysdate;  end;  /  alter trigger "account_biu" enable;  

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -