MyBatis executes the query statement, you can query the data in the Plsql, but you cannot query in the program

Source: Internet
Author: User
Today with MyBatis query statements, the console output of the SQL statement can be executed in Plsql, but the query is no data.
The original query statement is as follows: (for privacy, the sensitive package name to the mosaic.) )

This SQL can be executed correctly in Plsql, but the data cannot be queried.

The workaround is to replace "#" in the query condition with "$".

The reasons are as follows: MyBatis See #{} will think you are assigning a value to a variable in SQL, just as you would assign a question mark in JDBC programming (automatically before and after a single quotation mark) that means that the string you passed in does not serve as multiple values, but as a large string, so the query is not a value)

When MyBatis sees ${}, it is replaced directly with the value of the variable without any processing.

MyBatis executes the query statement, you can query the data in the Plsql, but you cannot query in the program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.