SQL <= operator messes up xml

Hello,
I am trying using Liquibase for a project. When I write:

<preConditions>
<sqlCheck expectedResult=“1”>
SELECT COUNT(1) FROM TABLE_NAME WHERE ID <= 100
</sqlCheck>
</preConditions>

I find the “<” character (between tags) messes up the xml.
Is there a good solution for my problem? Many thanks.

According to this site:

You should be able to escape the < using &lt;

Hi @zhiqing

Could you give it a try using <![CDATA]> tag. Following is the syntax for CDATA :

<![CDATA[
   characters with markup
]]>

So in your case the changeset will look like below -

<preConditions>
<sqlCheck expectedResult=“1”>
<![CDATA[
SELECT COUNT(1) FROM TABLE_NAME WHERE ID <= 100
]]>
</sqlCheck>
</preConditions>

Please give it a try and let us know the results.

Thanks,
Rakhi Agrawal

1 Like

Many thanks for both of you. One of my colleagues will test your solutions and let you know the results.

1 Like