http://www.tutorialspoint.com/mybatis/mybatis_
dynamic_sql.htm
Copyright $ © $ tutorialspoint.com
Dynamic SQL is a very powerful feature of MyBatis. It enables programmers to build queries based on to write the query using the
dynamic SQL.
MyBatis uses a powerful
Dynamic SQL language that can be used within any mapped SQL statement. Following are the OGNL based
Dynamic SQL expressions provided by when, otherwise
• trim where, set
• foreach
## The if Statement
The most common thing to do in
dynamic SQL is conditionally include a part of a where clause. For example –