Liquibase® version 3.8.5 is now available! Get it for free.
2018 XML Announcement
News All Previous Posts >>

Subscribe for email updates

- and/or -

Change: ‘update’

Updates data in an existing table

Available Attributes

NameDescription
catalogNameName of the catalogE.g. 'cat'
schemaNameName of the schemaE.g. 'public'
tableNameName of the tableE.g. 'person'

Nested Properties

NameDescription
columns / column [1..N]Data to updateNote: columns tag not required in XML
Attributes
name Name of the column to set
value New value of the column.
Note: If not set the first valueXXX defined is used in the order they appear.
valueNumeric integer value of the column.
valueBoolean boolean value of the column.
valueDate Date and/or Time value to set the column to. The value is specified in one of the following forms: "YYYY-MM-DD", "hh:mm:ss" or "YYYY-MM-DDThh:mm:ss".
valueComputed A value that is returned from a function or procedure call. This attribute shall contain the function name to call.
valueBlobFile Path to a file, whose contents will be written as a BLOB (i.e. chunk of binary data). Must be either absolute or relative to the Change Log file location (absolute paths are, e.g.: /usr/local/somefile.dat on Unix or c:\Directory\somefile.dat on Windows. Please refer to java.io.File javadoc for the details of what to consider relative/absolute path).
valueClobFile Path to a file, whose contents will be written as a CLOB (i.e. chunk of character data). Must be either absolute or relative to the Change Log file location (absolute paths are, e.g.: /usr/local/somefile.daton Unix or c:\Directory\somefile.dat on Windows. Please refer to java.io.File javadoc for the details of what to consider relative/absolute path).
encoding Name of the encoding (as specified in java.nio.Charset javadoc) of the CLOB file (specified in valueClobFile) contents. Default: 'UTF-8'
Note: used only when valueClobFile attribute is specified, ignored otherwise.
whereAllows to define the 'where' condition(s) stringE.g. 'name='Bob''
<changeSet author="liquibase-docs" id="update-example">
    <update catalogName="cat"
            schemaName="public"
            tableName="person">
        <column name="address" value="address value"/>
        <where>name='Bob'</where>
    </update>
</changeSet>
changeSet:
  id: update-example
  author: liquibase-docs
  changes:
  - update:
      catalogName: cat
      columns:
      - column:
          name: address
          value: address value
      schemaName: public
      tableName: person
      where: name='Bob'
{
  "changeSet": {
    "id": "update-example",
    "author": "liquibase-docs",
    "changes": [
      {
        "update": {
          "catalogName": "cat",
          "columns": [
            {
              "column": {
                "name": "address",
                "value": "address value"
              }
            }]
          ,
          "schemaName": "public",
          "tableName": "person",
          "where": "name='Bob'"
        }
      }]
    
  }
}

SQL Generated From Above Sample (MySQL)

UPDATE cat.person SET address = 'address value' WHERE name='Bob';

Database Support

DatabaseNotesAuto Rollback
DB2/LUWSupportedNo
DB2/zSupportedNo
DerbySupportedNo
FirebirdSupportedNo
H2SupportedNo
HyperSQLSupportedNo
INGRESSupportedNo
InformixSupportedNo
MariaDBSupportedNo
MySQLSupportedNo
OracleSupportedNo
PostgreSQLSupportedNo
SQL ServerSupportedNo
SQLiteSupportedNo
SybaseSupportedNo
Sybase AnywhereSupportedNo