Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6684759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:58:38+00:00 2026-05-26T04:58:38+00:00

I have a query that will need to run 28 000 times in a

  • 0

I have a query that will need to run 28 000 times in a row, so I thought using a preparedStatement probably is a clever idea.

Here is my query :

String requestWithFirstName = "SELECT SE.ELEMENT_ID, SE.LASTNAME||' '||SE.FIRSTNAME AS ELEMENT, (SCORE(1)+SCORE(2))/2 AS SCORE "
                        + "FROM BL_SUSPICIOUS_ELEMENT SE "
                        + "WHERE CONTAINS(SE.LASTNAME, 'fuzzy({' || ? || '},' || ? || ',' || ? || ', weight)' , 1)>0 "
                        + "AND CONTAINS(SE.FIRSTNAME,  'fuzzy({' || ? || '},' || ? || ',' || ? || ', weight)' , 2)>0 "
                        + (type > 0 ? "AND SE.ELEMENT_TYPE_ID = ?" : "") 
                        + " ORDER BY SCORE DESC";

Everthings worked fine until we realized that the fuzzy methods doesn’t perform well for splitted words like ‘pikachu is my hero’ and it is advised to created, in this case, 4 fuzzy search for ‘pikachu’ ‘is’ ‘my’ ‘hero’. Not sure if this is true, but as I will run the query 28 000 times it’s a good opportunity to see it in action.

So I tried to modify the query in this manner :

 "SELECT A.ELEMENT_ID, A.LASTNAME||' '||A.FIRSTNAME AS AKA, SCORE(1) AS SCORE "
        + "FROM BL_AKA A, BL_SUSPICIOUS_ELEMENT SE " 
        + "WHERE CONTAINS(A.LASTNAME, ?, 1)>0 " 
        + "AND SE.ELEMENT_ID = A.ELEMENT_ID "
        + (type > 0 ? "AND SE.ELEMENT_TYPE_ID = ?": "") 
        + " ORDER BY SCORE DESC";

In this case, ? will be set to :

‘fuzzy({Burnham},70,4,weight),fuzzy({Investors},70,4,weight),fuzzy({Trust},70,4,weight)’

The query seems fine, running on sql dev. However, with Java, I get the following error :

ORA-20000: Oracle Text error:
DRG-50900: text query parser error on line 1, column 30
DRG-50920: part of phrase not itself a phrase or equivalence
DRG-50900: text query parser error on line 1, column 30
DRG-50920: part of phrase not itself a phrase or equivalence

Any advice ?
I wonder if this is the same situation as the in statement (impossible to create a select * from pokemon where monster in (?))

Thanks !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:58:39+00:00Added an answer on May 26, 2026 at 4:58 am

    When you use a prepared statement in java, it will set the parameter according to the method you use. So

    String s = "'fuzzy({Burnham},70,4,weight),fuzzy({Investors},70,4,weight),fuzzy({Trust},70,4,weight)'";
    statement.setString(s);
    

    will be escaped again and results in:

    '''fuzzy({Burnham},70,4,weight),fuzzy({Investors},70,4,weight),fuzzy({Trust},70,4,weight)'''
    

    Try to set the parameter without the quotes.

    You can create an IN (?) statement. But you will have to add a questionmark for every parameter: WHERE monster IN (?,?,?,?,?,?)…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP code, that will run a Select query to check if
I am using in C# MYsql .I have query that works if I run
So, I have a huge query that I need to run on an Access
I have a query that will return results from 2 tables into 1 using
I need to run a query that will return multiple rows and export it
I have a query that will be put into a procedure, and it will
I have a page a query that will set a table to 0 or
I have a problem with an sql query that will not work if I
I want to add an extra field to my query that will have the
I have a simple query: $query = new WP_Query('showposts=5'); that will obviously display 5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.