Oracle Fuzzy query (the condition that the JSP page passes over)

Source: Internet
Author: User


Statements for Oracle data fuzzy queries:

SELECT m.musicid,m.musicname,m.musicpicture,m.musiclyrics,m.musicinstruction from MUSIC m where m.musicname like '% see% ' ;

Originally, I was going to implement a fuzzy query based on the keywords I entered, by invoking the fuzzy query in action after the entity Class (entity), the Data Access Layer (DAO), and the Business Logic Layer (BIZ) encapsulation.


Tried a lot of SQL did not use the hint as "not correct statement"

For example:

Sql= "Select M.musicid,m.musicname,m.musicpicture,m.musiclyrics,m.musicinstruction from MUSIC m where m.musicname like '% ' + '?% ' "; <strong><span style=" color: #ff0000; " >//Error Statements </span></strong>
The question mark and quotation mark to swap or not to be the correct SQL statement.


Finally, I can only handle SQL directly in the action method in Struts2


String Searchname=req.getparameter ("Searchname"); the//jsp page passes over the search keyword string sql= "select M.musicid,m.musicname,m. Musicpicture,m.musiclyrics,m.musicinstruction from MUSIC m where  m.musicname like<span style= "color: #ff0000;" > '% ' +searchname+ "% '" </span>;//SQL statement for fuzzy query                                                                                                                                                                     dbutil util = new Dbutil (); <span style= "White-space:pre" ></span>resultset rs =util. Query (SQL);                                                                                                                                 ...... <span style= "color: #6600cc;" > The next step is to process the SQL statement </span>

Finally, the fuzzy query is realized by the method above


JSP page code:

<s:form action= "Music_fuzzyquerymusicinfo.action" method= "POST" ><input type= "text" name= "SearchName" id= " Searchname "placeholder=" song name "  /><input type=" Submit "value=" Search  /></s:form>



Oracle Fuzzy query (the condition that the JSP page passes over)

Related Article

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.