createFunction
Note: This is a Liquibase Pro Change Type, so you need a Liquibase Pro License Key to use it.
Creates a stored function.
Available attributes
Name | Description | Required for | Supports | Since |
---|---|---|---|---|
catalogName
|
Name of the catalog |
asany, db2, db2z, derby, firebird, h2, hsqldb, informix, ingres, mariadb, mysql, oracle, postgresql, sqlite, sybase |
||
dbms
|
Specifies which database types the change must be applied to. Valid database type names are listed on the supported databases page. Separate multiple databases with commas. Specify that a change does not apply to a database type by prefixing it with ! . The keywords all and none are also available. |
all | 3.1 | |
encoding
|
Encoding used in the file defined in the path attribute |
all | ||
functionBody
|
all | all | ||
functionName
|
Name of the function to drop | all | all | |
path
|
File containing the procedure text. Either this attribute or a nested procedure text is required. | all | all | |
procedureText
|
The SQL creating the procedure. Either this or the path attribute needs to be defined. |
all | all | |
relativeTo
|
Whether the file path relative to the changelog file rather than looked up in the search path. | all | ||
replaceIfExists
|
If the stored procedure defined by procedureName already exits alter it instead of creating it. The default value is false. |
all | ||
schemaName
|
Name of the schema |
all |

<changeSet author="liquibase-docs" id="createFunction-example">
<pro:createFunction catalogName="cat"
dbms="h2, !oracle, mysql"
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
dbms: h2, !oracle, mysql
encoding: UTF-8
functionBody: A String
functionName: A String
path: com/example/my-logic.sql
relativeToChangelogFile: true
replaceIfExists: false
schemaName: public

{
"changeSet": {
"id": "createFunction-example",
"author": "liquibase-docs",
"changes": [{
"createFunction": {
"catalogName": "cat",
"dbms": "h2, !oracle, mysql",
"encoding": "UTF-8",
"functionBody": "A String",
"functionName": "A String",
"path": "com/example/my-logic.sql",
"relativeToChangelogFile": true,
"replaceIfExists": false,
"schemaName": "public"
}
}]
}
}
Database support
Database | Notes | Auto Rollback |
---|---|---|
DB2/LUW | Supported | Yes |
DB2/z | Supported | Yes |
Derby | Supported | Yes |
Firebird | Supported | Yes |
H2 | Supported | Yes |
HyperSQL | Supported | Yes |
INGRES | Supported | Yes |
Informix | Supported | Yes |
MariaDB | Supported | Yes |
MySQL | Supported | Yes |
Oracle | Supported | Yes |
PostgreSQL | Supported | Yes |
Snowflake | Supported | Yes |
SQL Server | Supported | Yes |
SQLite | Not Supported | No |
Sybase | Supported | Yes |
Sybase Anywhere | Supported | Yes |