Liquibase® version 3.8.2 is now available! Get it for free.
2018 XML Announcement
News 5 Ways to Fix a Bad Database Change in Liquibase
04 Dec 2019

- and/or -

All Previous Posts >>

Change: ‘createFunction’

Creates a stored function

Available Attributes

NameDescriptionRequired ForSupportsSince
catalogNameName of the catalogasany, db2, db2z, derby, firebird, h2, hsqldb, informix, ingres, mariadb, mysql, oracle, postgresql, sqlite, sybase
commentsall
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
procedureTextall
relativeToChangelogFileall
replaceIfExistsall
schemaNameName of the schemaall
<changeSet author="liquibase-docs" id="createFunction-example">
    <pro:createFunction catalogName="cat"
            comments="A String"
            dbms="h2, oracle"
            encoding="UTF-8"
            functionName="A String"
            path="com/example/my-logic.sql"
            relativeToChangelogFile="true"
            replaceIfExists="false"
            schemaName="public">A String</pro:createFunction>
</changeSet>
changeSet:
  id: createFunction-example
  author: liquibase-docs
  changes:
  - createFunction:
      catalogName: cat
      comments: A String
      dbms: h2, oracle
      encoding: UTF-8
      functionBody: A String
      functionName: A String
      path: com/example/my-logic.sql
      procedureText: |-
        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",
    "changes": [
      {
        "createFunction": {
          "catalogName": "cat",
          "comments": "A String",
          "dbms": "h2, oracle",
          "encoding": "UTF-8",
          "functionBody": "A String",
          "functionName": "A String",
          "path": "com/example/my-logic.sql",
          "procedureText": "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
DB2SupportedNo
DerbySupportedNo
FirebirdSupportedNo
H2SupportedNo
HyperSQLSupportedNo
INGRESSupportedNo
InformixSupportedNo
MariaDBSupportedNo
MySQLSupportedNo
OracleSupportedNo
PostgreSQLSupportedNo
SQL ServerSupportedNo
SQLiteSupportedNo
SybaseSupportedNo
Sybase AnywhereSupportedNo