Search code examples
delimiterliquibase

What's the usage of "endDelimiter:@" in db (in my case liquibase)


I just started with liquibase and ran into this line in one of the changelogs:

--changeset NAME.SURNAME:1 endDelimiter:@ rollbackEndDelimiter:@

What is the usage of "endDelimiter:@". I think it replaces the default end-delimiter (character that defines end of line) which is ";" but why?

Sorry if my question is not formatted properly this is my very first one :)


Solution

  • An end delimiter is used if the changeset contains SQL that e.g. creates a stored procedure (or function) where the code itself contains a ; to separate the statements inside the procedure.

    If Liquibase split the code using the ; an incomplete DDL statement would be sent to the database. Therefor you need to have a different delimiter that marks the end of e.g. the CREATE PROCEDURE statement.