When writing code today, because the business needs to be used in mybatis, it is bigger than the number, less than the number, so it is directly used in SQL.
SELECT * FROM test WHERE 1 = 1 AND start_date <= CURRENT_DATE AND end_date> = CURRENT_DATE
However, an error is reported during execution:
Error creating document instance. Cause: org. xml. sax. SAXParseException; lineNumber: 74; columnNumber: 17; the content of the element must consist of correctly formatted character data or tags.
Remove AND start_date> = CURRENT_DATE AND end_date <= CURRENT_DATE, so there is no problem. Therefore, it is determined that the problem is caused by a number greater than or less than the number.
So I thought of the special symbols, So I replaced the> and <with escape characters, and then there was no problem.
SELECT * FROM test WHERE 1 = 1 AND start_date & lt; = CURRENT_DATE AND end_date & gt; = CURRENT_DATE
Appendix: XML escape characters
& Lt; <Yu no.
& Gt;> greater
& Amp; & and
& Apos; 'single quotes
& Quot; "Double quotation marks