Need Liquibase® support? Liquibase Pro is now available! Try it out free.
2018 XML Announcement

Change: ‘createFunction’

Creates a stored function

Available Attributes

NameDescriptionRequired ForSupportsSince
catalogNameName of the catalogall
dbmsall3.1
encodingall
functionBodyallall
functionNameName of the function to dropallall
pathFile containing the procedure text. Either this attribute or a nested procedure text is required.all
procedureBodyall
relativeToChangelogFileall
replaceIfExistsall
schemaNameName of the schemaall
<changeSet author="liquibase-docs"
        id="createFunction-example"
        objectQuotingStrategy="LEGACY">
    <ext:createFunction catalogName="cat"
            dbms="h2, oracle"
            encoding="UTF-8"
            functionName="A String"
            path="com/example/my-logic.sql"
            relativeToChangelogFile="true"
            replaceIfExists="false"
            schemaName="public">A String</ext:createFunction>
</changeSet>
changeSet:
  id: createFunction-example
  author: liquibase-docs
  objectQuotingStrategy: LEGACY
  changes:
  - createFunction:
      catalogName: cat
      dbms: h2, oracle
      encoding: UTF-8
      functionBody: A String
      functionName: A String
      path: com/example/my-logic.sql
      procedureBody: |-
        CREATE OR REPLACE PROCEDURE testHello
            IS
            BEGIN
              DBMS_OUTPUT.PUT_LINE('Hello From The Database!');
            END;
      relativeToChangelogFile: true
      replaceIfExists: false
      schemaName: public
{
  "changeSet": {
    "id": "createFunction-example",
    "author": "liquibase-docs",
    "objectQuotingStrategy": "LEGACY",
    "changes": [
      {
        "createFunction": {
          "catalogName": "cat",
          "dbms": "h2, oracle",
          "encoding": "UTF-8",
          "functionBody": "A String",
          "functionName": "A String",
          "path": "com/example/my-logic.sql",
          "procedureBody": "CREATE OR REPLACE PROCEDURE testHello\n    IS\n    BEGIN\n      DBMS_OUTPUT.PUT_LINE('Hello From The Database!');\n    END;",
          "relativeToChangelogFile": true,
          "replaceIfExists": false,
          "schemaName": "public"
        }
      }]
    
  }
}

Database Support

DatabaseNotesAuto Rollback
DB2SupportedNo
DerbyNot SupportedNo
FirebirdNot SupportedNo
H2Not SupportedNo
HyperSQLNot SupportedNo
INGRESNot SupportedNo
InformixNot SupportedNo
MariaDBNot SupportedNo
MySQLNot SupportedNo
OracleSupportedNo
PostgreSQLSupportedNo
SQL ServerSupportedNo
SQLiteNot SupportedNo
SybaseNot SupportedNo
Sybase AnywhereNot SupportedNo

Missing, incomplete or wrong information? Please send a pull request