The createProcedure Change Type defines the definition for a stored procedure. This Change Type is better to use for creating procedures than the raw SQL command because it will not attempt to strip comments or break up lines.

Often times it is best to use the CREATE OR REPLACE syntax along with setting runOnChange='true' on the enclosing changeset tag. That way if you need to make a change to your procedure, you can change your existing code rather than creating a new REPLACE PROCEDURE call. The advantage to this approach is that it keeps your changelog smaller and allows you to more easily see what has changed in your procedure code through your source control system's diff command.

Available attributes

Name Description Required for Supports
catalogName The name of the catalog all
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
encoding The encoding used in the file defined in the path attribute all
path The file containing the procedure text. Either this attribute or a nested procedure text is required. all all
procedureText The SQL creating the procedure. You need to define either this attribute or the path attribute. The procedureText attribute is not supported in the XML format; however, you can specify the procedure SQL within <createProcedure></createProcedure> tags. See the XML example. all all
procedureName The name of the procedure. It is required if replaceIfExists= true mssql
relativeToChangelogFile Defines whether the file path is 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. mssql
schemaName The name of the schema all

Database support

Database Notes Auto rollback
DB2/LUW Supported No
DB2/z Supported No
Derby Supported No
Firebird Supported No
H2 Supported No
HyperSQL Supported No
INGRES Supported No
Informix Supported No
MariaDB Supported No
MySQL Supported No
Oracle Supported No
PostgreSQL Supported No
Snowflake Supported No
SQL Server Supported No
SQLite Not Supported No
Sybase Supported No
Sybase Anywhere Supported No