user3488996 user3488996 - 4 months ago 76
SQL Question

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

I am looking for an example on how to use the

<whereparams></whereparams>
which belongs to
<update></update>
, but I couldn't find anything (even in the official documentation).

any help is much appreciated.thanks.

Answer

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"/>
        <where>id=:value</where>
        <whereParams>
            <param valueNumeric="134" />
        </whereParams>
</update>

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.