mybatis中写sql语句时需要转义的字符

    xiaoxiao2021-03-25  134

    mybatis配置文件,sql语句中含有转义字符:

    错误语句:

    DATE_SUB(CURDATE(), INTERVAL 3 DAY) <= DATE(a.create_date)

    错误信息:

      Caused by: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 54; The entity name must immediately follow the ‘<’ in the entity reference.

    正确语句:

      select * from table_base where flag_topic & #{topic_num}

    将语句中的位运算(与)”<“符使用“<”替换

    mybatis配置文件写SQL语句的某些字符需要转义:

    &lt; < &gt; > &lt;&gt; <> & & ' ' " "

    注意:要加上分号!

    转载请注明原文地址: https://ju.6miu.com/read-12329.html

    最新回复(0)