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 7893303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:05:55+00:00 2026-06-03T07:05:55+00:00

Given the following Oracle sql query cooked for a PreparedStatement : SELECT * FROM

  • 0

Given the following Oracle sql query cooked for a PreparedStatement:

SELECT *
FROM my_table
WHERE field1 = 'foo'
and field2 =ANY (substr( ? , 1, 2) || '00000000',
                 substr( ? , 1, 4) || '000000',
                 substr( ? , 1, 6) || '0000',
                 substr( ? , 1, 8) || '00',
                 ?
                )

I want to translate to a JPQL query. Reading the JPQL doc, substr becomes substring
and ANY stays as it is. In JPQL ANY expects a subquery.

How can I change the list into a subquery ? or should I use IN operator or should I generate a JPQL string with a bunch of OR conditions in it ?

Oracle 10gR2
Java 5
JPA 2

  • 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-06-03T07:05:57+00:00Added an answer on June 3, 2026 at 7:05 am

    Considering that = ANY(...) is equivalent to IN (...) in SQL, you can safely use IN.

    In fact, the IN predicate is defined in terms of the ANY predicate. Excerpt of the SQL 1992 standard:

    8.4 <in predicate>

    […]

    <in predicate> ::=
        <row value constructor>
          [ NOT ] IN <in predicate value>
    

    […]

    2) Let RVC be the <row value constructor> and let IPV be the <in predicate value>.

    […]

    4) The expression

      RVC IN IPV
    

    is equivalent to

      RVC = ANY IPV  
    

    Then again, the ANY / SOME <quantified comparison predicate> operators are defined in a way similar to a bunch of OR connected predicates. Hence the answer is: You can use both IN or OR-connected predicates.

    Note: While this answer explains things how they are in SQL, I’m pretty sure something similar applies to JPQL as well.

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

Sidebar

Related Questions

The following query is given in a PL/SQL procedure . SELECT e.data FROM extra
Given following Statment: String query = "Select * from T_spareParts where SparePartPK IN (?
Given the following Oracle (10g) package definition: create or replace PACKAGE foo AS bar
I have the following Oracle query: SELECT id, DECODE(state, 'Open', state_in, NULL) AS open_in,
The following query generates the error below in 10g: select DBMS_METADATA.GET_DDL('TABLE','TEST_TABLE','TEST') from dual; Got:
I have following SQL: select origin,destination,to_char(to_date(substr(ship_date,1,6),'YYMMDD'), 'YYYY-MM-DD'),ship_date,trip_number, distinct ship_number from shipment a where a.scc_code
I'm trying to convert the following statement from SQL Server to Oracle, but everything
Given the following two ways of defining a class method in Ruby: class Foo
Given the following HTML <b>demo</b> I want to save it to an SQL 2005
I have been profiling the SQL query NHibernate generates for the following snippets below.

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.