user3488996 user3488996 - 1 year ago 156
SQL Question

LiquiBase : How to use <whereparams> inside an <update>?

I am looking for an example on how to use the

which belongs to
, but I couldn't find anything (even in the official documentation).

any help is much appreciated.thanks.

Answer Source

An example usage is

<update tableName="updateTest">
        <column name="varcharColumn" value="new column 1 value"/>
        <column name="dateCol" valueDate="2008-01-01"/>
        <column name="intCol" valueNumeric="11"/>
            <param valueNumeric="134" />

where the :value statements in the <where> block is replaced with the values in the `param' blocks. If there are multiple :value statements they are replaced in order within the where clause.

However, looking at the code, it looks like the usage of whereParams is not well used or integrated. Perhaps I am missing where it is being picked up, but it may not even be working outside blob/clob updating.

Give it a try and see if it works for you, otherwise I'd say stick with the standard where block until support is improved.